473,325 Members | 2,712 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,325 software developers and data experts.

How to add parameter into data adapter

string connectionString = ConfigurationManager.ConnectionStrings["OASConnectionString1"].ConnectionString;
SqlConnection con = new SqlConnection(connectionString);
count = 10;
string sql = "Select * from Client Where QuotationNo like @prefixText";
SqlDataAdapter da = new SqlDataAdapter(sql, con);
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%";
DataTable dt = new DataTable();
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Notice_Subject"].ToString(), i);
i++;
}
return items;

above code is working perfectly
Sir i want to add few more parameters in where clause
and at the same time i want to add Parameters relating to new added Search field..
for ex:-
string sql = "Select * from Client Where QuotationNo like @prefixText" and QuotationNo="@QuoNo";
SqlDataAdapter da = new SqlDataAdapter(sql, con);
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%";
SqlDataAdapter da = new SqlDataAdapter(sql, con);
da.SelectCommand.Parameters.Add("@QuotationNo", SqlDbType.VarChar, 50).Value = QuotationNo.text;
Something Like this its not working correctly, in simple word my question is to add more than one parameter in dataadapter
Sep 5 '11 #1
0 1294

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: JR | last post by:
I am accessing a MS SQL2000 database. The table has a date field setup as 'Datetime' I then setup a data adapter (VB.Net, windows) as follows daEmpDiv = New SqlClient.SqlDataAdapter("SELECT...
0
by: Randy Smith | last post by:
Hi ALL, I have a simple ASPX.Net page where I am trying to add an SQLDataAdapter, and want to use stored SQL procedures with parameters. When I look at the stored procedure in Server Explorer,...
5
by: Rick | last post by:
The data adapter wizard allows you to add more than one table, but that doesn't seem to work right when setting up a dataset. Some of the documentation I have read states that only one table...
2
by: Parveen | last post by:
I want the data adapter wizard to automatically generate update, insert, and delete statements from a given select statement if the select statement is a multiple table query. I know this works...
4
by: Agnes | last post by:
I am confused about these two things 1st)As form load I new a data adapter programmicaly , and I can use stored procedure to 'select sth ' and then fill into the dataset.by using binding context,...
2
by: simon | last post by:
I use my functions to create adapter and fill dataSet: funkcije.createAdapter("c_CPOSkupaj", False, myParams).Fill(ds, "brezReklam") If I use this function another time to fill dataSet with...
3
by: TS | last post by:
Hi everyone, I wrote the following code to pass a parameter value to the Data Adapter to fill in the dataset based on the parameter's value....
7
by: GatorBait | last post by:
Hi all, I am having a problem with my data adapter update command. I have generated the data adapter in the IDE and then I built a dataset. The dataset can get changed in the program and I...
5
by: Alan Pretre | last post by:
In VS 2003 when I use the Configure Data Adapter option in VS 2003 I get the size parameter to the SqlParameter set to the correct size for a varchar, for example, .... new...
0
by: mwenz | last post by:
I am trying to update an Access table using OLEDB in VB.Net 2005. I can add rows but I cannot update them. Code to instantiate the Access database and table... Dim conn As New...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.