表达式中未定义的函数

时间:2016-09-22 19:13:26

标签: vb.net

当我更新访问数据库记录时,我收到此错误(表达式中未定义的函数(第一项))。这是我的代码

Try
    d.Dataedit(String.Format("delete from ptsense where PT_Date=#{0}# and PT_Code={1}", Textdate.Text, Textcode.Text))

    If listselect.Items.Count > listres.Items.Count Or listselect.Items.Count = listres.Items.Count Then
        For i As Integer = 0 To listselect.Items.Count - 1
            d.Dataedit(String.Format("insert into ptsense(PT_Name,PT_Date,PT_Code,sample,G,coun,comm,organism,sens)values('{0}',#{1}#,{2},'{3}','{4}','{5}','{6}','{7}','{8}')", txtname.Text, Textdate.Text, Textcode.Text, Comsample.Text, Comstain.Text, Txtcount.Text, Txtcomm.Text, Comorganism.Text, listselect.Items(i).ToString))
        Next
        For i As Integer = 0 To listres.Items.Count - 1
            d.Dataedit(String.Format("update ptsense set resist={0} where PT_Date=#{1}# and PT_Code={2}", listres.Items(i).ToString, Textdate.Text, Textcode.Text))
        Next

    Else

        For i As Integer = 0 To listres.Items.Count - 1
            d.Dataedit(String.Format("insert into ptsense(PT_Name,PT_Date,PT_Code,sample,G,coun,comm,organism,resist)values('{0}',#{1}#,{2},'{3}','{4}','{5}','{6}','{7}','{8}')", txtname.Text, Textdate.Text, Textcode.Text, Comsample.Text, Comstain.Text, Txtcount.Text, Txtcomm.Text, Comorganism.Text, listres.Items(i).ToString))
        Next
        For i As Integer = 0 To listselect.Items.Count - 1
            d.Dataedit(String.Format("update ptsense set sens={0} where PT_Date=#{1}# and PT_Code={2}", listselect.Items(i).ToString, Textdate.Text, Textcode.Text))

        Next
    End If


Catch ex As Exception
    MsgBox(ex.Message)
End Try

0 个答案:

没有答案