rvermeulen Posted April 22, 2003 Posted April 22, 2003 I thought this was fairly straight forward, but I'm having difficulty getting my DataAdapter to accept the values of my parameters. I've created a connection and DataAdapter from the design window, and configured my DataAdapter through the QueryBuilder. In the QueryBuilder, I added 4 where criteria, such as "LIKE @city". From my understanding, I've created 4 parameters that I can pass to the SelectCommand to help qualify the records to be loaded into the dataset. I've verified that the Parameter value is what the user has entered from the WebForm, I'm just not sure why the DataAdapter is not populating the parameter value into the SelectCommand. I've appended the % sign to each parameter since each one is using a LIKE statement in the sql statement. Here is my code: If txtGroupNumber.Text.Trim <> "" Then daGroup.SelectCommand.Parameters.Add("@groupnumber", txtGroupNumber.Text.Trim.ToString & "%") Else daGroup.SelectCommand.Parameters.Add("@groupnumber", "%") End If If txtGroupName.Text.Trim <> "" Then daGroup.SelectCommand.Parameters.Add("@groupname", txtGroupName.Text.Trim.ToString & "%") Else daGroup.SelectCommand.Parameters.Add("@groupname", "%") End If If txtAddress.Text.Trim <> "" Then daGroup.SelectCommand.Parameters.Add("@address1", txtAddress.Text.Trim.ToString & "%") Else daGroup.SelectCommand.Parameters.Add("@address1", "%") End If If txtCity.Text.Trim <> "" Then daGroup.SelectCommand.Parameters.Add("@city", txtCity.Text.Trim.ToString & "%") Else daGroup.SelectCommand.Parameters.Add("@city", "%") End If OleDbConn.Open() daGroup.Fill(DsGroupList1, "group") dgGroupList.DataBind() Please someone help me Thanks in advance. Rick Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.