|
-
May 12th, 2010, 02:20 AM
#1
Parameterized query with Select Command
string connectionString = "workstation id=AALOK;packet size=4096;user id=sa;data source=AALOK;persist security info=False;initial catalog=aks";
conn = new SqlConnection(connectionString);
string commandString = "SELECT QuesID, QuesDet, Quiz_Name FROM ak";
dataAdapter = new SqlDataAdapter(commandString, conn);
ds = new DataSet();
dataAdapter.Fill(ds,"Ak");
dataTable = ds.Tables["Ak"];
I have created an application using C# 2003 with SQL Server 2000.
The above code is working fine, but my requirement is to add "where Quiz_Name=@Quiz_Name" into the commandString and to set @Quiz_Name="Some string".
Can anyone help me to write the correct code?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|