Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database 更新和删除查询不';不包含多值字段_Database_Vb.net - Fatal编程技术网

Database 更新和删除查询不';不包含多值字段

Database 更新和删除查询不';不包含多值字段,database,vb.net,Database,Vb.net,这就是我正在做的。当patients count为0时,它可以工作,但当它增加时,假设为1,它会给出一个错误:“更新或删除查询不包含多值字段。”有什么问题,请帮助我解决。多谢各位 rs = New ADODB.Recordset With rs .Open("Select * from Doctor where DName='" & cmbDoctors.Text & "'", cn, 2, 3) If .Fields("Patients

这就是我正在做的。当patients count为0时,它可以工作,但当它增加时,假设为1,它会给出一个错误:“更新或删除查询不包含多值字段。”有什么问题,请帮助我解决。多谢各位

rs = New ADODB.Recordset
    With rs
        .Open("Select * from Doctor where DName='" & cmbDoctors.Text & "'", cn, 2, 3)

        If .Fields("Patients").Value = 10 Then
            MsgBox("All appointments had been taken. Please Select another Doctor.")
            Exit Sub
        End If
        patient = Txtname.Text
        If .Fields("Patients").Value = 0 Then
            .Fields("Patient0").Value = patient
        ElseIf .Fields("Patients").Value = 1 Then
            .Fields("Patient1").Value = patient
        ElseIf .Fields("Patients").Value = 2 Then
            .Fields("Patient2").Value = patient
        ElseIf .Fields("Patients").Value = 3 Then
            .Fields("Patient3").Value = patient
        ElseIf .Fields("Patients").Value = 4 Then
            .Fields("Patient4").Value = patient
        ElseIf .Fields("Patients").Value = 5 Then
            .Fields("Patient5").Value = patient
        ElseIf .Fields("Patients").Value = 6 Then
            .Fields("Patient6").Value = patient
        ElseIf .Fields("Patients").Value = 7 Then
            .Fields("Patient7").Value = patient
        ElseIf .Fields("Patients").Value = 8 Then
            .Fields("Patient8").Value = patient
        ElseIf .Fields("Patients").Value = 9 Then
            .Fields("Patient9").Value = patient
        End If
        .Fields("Patients").Value += 1
        .Fields("Fees").Value += txtAmount.Text
        .Update()
        .Close()
    End With
试试这个

rs = New ADODB.Recordset
  With rs
    .Open("Select * from Doctor where DName='" & cmbDoctors.Text & "'", cn, 2, 3)

    If .Fields("Patients").Value = 10 Then
        MsgBox("All appointments had been taken. Please Select another Doctor.")
        Exit Sub
    End If
    patient = Txtname.Text

    ' filter here that input is 0 to 9

    .Fields("Patient" & trim(.Fields("Patients").Value)).Value = patient

    .Fields("Patients").Value = .Fields("Patients").Value + 1
    .Fields("Fees").Value = .Fields("Fees").Value + val(txtAmount.Text)
    .Update()
    .Close()
End With

你在使用什么数据库?当我阅读多值字段时,我的第一个想法是Pick,但我相当怀疑它。你能发布你的表格结构吗?另外,这看起来像是经典的ASP,而不是VB.NET。我使用的是MS Access。表有15列1。ID 2。医生的名字3。任命日期4。医生费5。病人人数6-15人。10名患者。没有解决办法我必须克服它,请帮忙。