我正在尝试从 mysql 中的两个表中读取:
Dim sqlcom As MySqlCommand = New MySqlCommand("Select * from mother, father where IDNO= '" & TextBox14.Text & "' ", sqlcon)
- 但我得到这个错误:
Column 'IDNO' in where clause is ambiguous
这是整个代码:
Dim NoAcc As String
Dim NoAccmod2 As String
Dim NoPas As String
Dim sqlcon As New MySqlConnection("Server=localhost; Database=school;Uid=root;Pwd=nitoryolai123$%^;")
Dim sqlcom As MySqlCommand = New MySqlCommand("Select * from mother, father where IDNO= '" & TextBox14.Text & "' ", sqlcon)
sqlcon.Open()
Dim rdr As MySqlDataReader
rdr = sqlcom.ExecuteReader
If rdr.HasRows Then
rdr.Read()
NoAcc = rdr("IDNO")
If (TextBox14.Text = NoAcc) Then TextBox7.Text = rdr("MOTHER")
If (TextBox14.Text = NoAcc) Then TextBox8.Text = rdr("MOTHER_OCCUPATION")
If (TextBox14.Text = NoAcc) Then TextBox10.Text = rdr("FATHER")
If (TextBox14.Text = NoAcc) Then TextBox11.Text = rdr("FATHER_OCCUPATION")
End If
- 有什么可以帮助解决这个问题的建议吗?甚至其他技术可以实现使用数据阅读器从两个表中读取数据的目标?
这是一个 winform,而不是一个 web 表单