having problem with data grid view
-
Wednesday, August 15, 2012 9:36 AM
i am making an application an i am stuck at a problem. Need to view data from different tables by selecting the table name in a drop-down combo box. i have used the following code, which is giving me an error of 'No vale given for one or more parameters': -
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cnstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=C:\Users\Asimo\Desktop\Practise\Tables -Copy\practise.accdb;"
Dim cn As New OleDb.OleDbConnection(cnstring)
Dim da As New OleDb.OleDbDataAdapter
Dim dt As New DataTable
Dim name As String = ComboBox1.Text
cn.Open()
da = New OleDb.OleDbDataAdapter("select * from " + name + " order by cl_no", cn)
da.Fill(dt) 'This is where it is showing the error, so the error might be in my select statement
Me.DataGridView1.DataSource = dt
cn.Close()
End SubCAN ANYONE SUGGEST HOW I CAN RESOLVE THIS ISSUE?
All Replies
-
Wednesday, August 15, 2012 12:21 PM
Sorry guys... found the solution for this... had given a wrong column name.. that's y had got this error... 'No value for one or more given parameters' error comes when there is a mismatch in the columns mentioned in the query and of the table.... Thanks...- Proposed As Answer by Armin Zingler Wednesday, August 15, 2012 2:03 PM
- Marked As Answer by Shanks ZenMicrosoft Contingent Staff, Moderator Thursday, August 16, 2012 2:40 AM
-
Thursday, August 16, 2012 2:40 AMModerator
Glad to see you have found another solution and thanks for sharing.
Best regards,
Shanks Zen
MSDN Community Support | Feedback to us

