Error message " No value given to one or more parameter"

  • Thread starter Thread starter lolbird1212
  • Start date Start date
L

lolbird1212

Guest
Hi

I am new to this type of work and have little idea what I am doing. I am currently getting error message " No values given to one or more parameter" when I'm trying to retrieve data from access to Microsoft visual studio 2010. I want the user to be able to type something in textbox1 and then have the other 3 textboxes auto fill with the info its got from access. Would anyone be able to take a look at my code and see where I could be going wrong? I think its a connection issue between VB and access.


Thanks in advance

Code is -

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim con As New OleDb.OleDbConnection
con.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Y:\Training Matrix\Training matrix database1.accdb")
con.Open()
Dim strsql As String
strsql = " SELECT wsx, edc, rfv, tgb from qaz where wsx=" + TextBox1.Text
Dim cmd As New OleDb.OleDbCommand(strsql, con)
Dim myreader As OleDbDataReader
myreader = cmd.ExecuteReader
myreader.Read()
TextBox1.Text = myreader("wsx")
TextBox3.Text = myreader("tgb")
TextBox4.Text = myreader("rfv")
TextBox5.Text = myreader("tgb")

con.Close()
End Sub
End Class
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim con As New OleDb.OleDbConnection
con.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Y:\Training Matrix\Training matrix database1.accdb")
con.Open()
Dim strsql As String
strsql = " SELECT wsx, edc, rfv, tgb from qaz where wsx=" + TextBox1.Text
Dim cmd As New OleDb.OleDbCommand(strsql, con)
Dim myreader As OleDbDataReader
myreader = cmd.ExecuteReader
myreader.Read()
TextBox1.Text = myreader("wsx")
TextBox3.Text = myreader("tgb")
TextBox4.Text = myreader("rfv")
TextBox5.Text = myreader("tgb")

con.Close()
End Sub
End Class

Continue reading...
 
Back
Top