Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27069

VS 2008 No value given for one or more required parameters.

$
0
0
Hi, I have been using VB.net since last 6 months only. I have been going through the various forum replies on the captioned error but I wanted to post my query which is as under:

I have a combobox in which Location details are populated from access table1. Based on the user's selection of a location from the combobox, I want to select all the records of table1 where in value in location field equals selection from combobox and populate all those records in checked grid view. My code is as under:

Dim Conn As New OleDb.OleDbConnection
Dim sql1 As String
Dim command1 As New OleDb.OleDbCommand
Dim oleAdapter1 As New OleDb.OleDbDataAdapter
Dim UserDataSet1 As New DataSet
'Dim usid As String
'Dim x As Integer
Conn = New OleDb.OleDbConnection
Conn.ConnectionString = "provider = Microsoft.ACE.OLEDB.12.0;data source = c:\renuka\Project1\sewage pumps.accdb"
sql1 = "Select * from Table1 where Table1.Location = ComboBox7.text"
Conn.Open()
command1 = New OleDb.OleDbCommand(sql1, Conn)
command1.ExecuteNonQuery()
oleAdapter1 = New OleDb.OleDbDataAdapter("Select * From Table1 where Table1.Location = combobox7.text", Conn)
UserDataSet1 = New DataSet
oleAdapter1.Fill(UserDataSet1, "Table1")
DataGridView1.DataSource = UserDataSet1.Tables(0)

I have checked the spellings of my field, table etc but nothing seems amiss. I am getting the error "No value given for one or more required parameters just after sql1 select statement. Would really appreciate help on this.

Viewing all articles
Browse latest Browse all 27069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>