473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Adding Parameters to WHERE clause in DataAdapter

What am I doing wrong? I want to be able to add parameters to my WHERE
clause in my sqlDataAdapter. I also want to use LIKE. (ie. style_cd like
"%123%"

sqlDataAdapter1.SelectCommand.Parameters.Add("@sty le_cd",SqlDbType.VarChar,15);

sqlDataAdapter1.SelectCommand.Parameters["@style_cd"].Value =
txt_style.Text;

dataSet11.Clear();

sqlDataAdapter1.Fill(dataSet11);

DataGrid1.DataBind();
Nov 16 '05 #1
3 7671
VJ
Whats the error you are getting? , could also post the SQL statment (just
the part were parameter is being used)

VJ

"Mike D" <md*****@nospambennettcompany.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
What am I doing wrong? I want to be able to add parameters to my WHERE
clause in my sqlDataAdapter. I also want to use LIKE. (ie. style_cd like
"%123%"

sqlDataAdapter1.SelectCommand.Parameters.Add("@sty le_cd",SqlDbType.VarChar,15);

sqlDataAdapter1.SelectCommand.Parameters["@style_cd"].Value =
txt_style.Text;

dataSet11.Clear();

sqlDataAdapter1.Fill(dataSet11);

DataGrid1.DataBind();

Nov 16 '05 #2
I don't get an error message. It just returns all the rows in the database.

"VJ" <vi********@yahoo.com> wrote in message
news:uU**************@TK2MSFTNGP12.phx.gbl...
Whats the error you are getting? , could also post the SQL statment (just
the part were parameter is being used)

VJ

"Mike D" <md*****@nospambennettcompany.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
What am I doing wrong? I want to be able to add parameters to my WHERE
clause in my sqlDataAdapter. I also want to use LIKE. (ie. style_cd like
"%123%"

sqlDataAdapter1.SelectCommand.Parameters.Add("@sty le_cd",SqlDbType.VarChar,15);

sqlDataAdapter1.SelectCommand.Parameters["@style_cd"].Value =
txt_style.Text;

dataSet11.Clear();

sqlDataAdapter1.Fill(dataSet11);

DataGrid1.DataBind();


Nov 16 '05 #3
What is the error ?

with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
1
by: James | last post by:
I have an sp with paramaters like this: ALTER PROCEDURE dbo.SomeProc ( @SortBy varchar(50) = NULL @ShowComplete bit = 0 @StaffID int = NULL ) AS DECLARE @SQL varchar(2500) SET @SQL =
10
by: Adis | last post by:
Asp.Net Visual Studio 2003 SQL Server. Hi, Obtaining Data Based Upon Multiple Selections From a ListBox... I have database in Sqlserver and ListBox (Multiple Selection Mode) in my Visual...
10
by: Trevor | last post by:
Hey, I am trying to do this tutorial on the microsoft site : http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dndotnet/html/usingadonet.asp I can get everything to work up to...
6
by: Jack | last post by:
I have the following: * An OLEDBCommand with command text "SELECT CAMPAIGN, DAY_OUT WHERE (CAMPAIGN LIKE '@campaign')" * A DataAdapter that point the select to the above command * A data grid...
1
by: Locke | last post by:
I know I'm doing something wrong, and it's something simple but I can't figure it out. I'm new at this and it's only a little more than a hobby so please bear with me. I'm writing a VB shell...
1
by: Rich | last post by:
Hello, I can update a dataset from my client app using a dataAdapter.Updatecommand when I add parameter values outside of the param declaration. But If I add the param values inline with the...
7
by: Miro | last post by:
Im a VB Newbie so I hope I'm going about this in the right direction. I have a simple DB that has 1 Table called DBVersion and in that table the column is CurVersion ( String ) Im trying to...
2
by: mdfayazi | last post by:
I am using dataadapter to Add,Update,Delete rows in a datagridview.Update and delete are working but while adding a rows the problem comes.When I add more than one row only first row values are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.