having problem with data grid view
-
15 สิงหาคม 2555 9:36
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?
ตอบทั้งหมด
-
15 สิงหาคม 2555 12:21
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...- เสนอเป็นคำตอบโดย Armin Zingler 15 สิงหาคม 2555 14:03
- ทำเครื่องหมายเป็นคำตอบโดย Shanks ZenMicrosoft, Moderator 16 สิงหาคม 2555 2:40
-
16 สิงหาคม 2555 2:40ผู้ดูแล
Glad to see you have found another solution and thanks for sharing.
Best regards,
Shanks Zen
MSDN Community Support | Feedback to us