TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
richard smith
1.5k
285
160.2k
Add A Parameter to Query String populating Datagrid
Mar 25 2013 10:10 AM
I am using the below to populate a datagrid...works great. Now I want to add a parameter and am not sure how to.
I am working with this code to populate (Note this does not add a parameter like I want)
string SQLString = "Select * from tableInformation";
SqlDataAdapter dataAdapter = new SqlDataAdapter(SQLString, connectionString);
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
DataTable table = new DataTable();
dataAdapter.Fill(table);
bsBindingSource1.DataSource = table
datagridview1.AutoResizeColumns(DataGridViewAutoSizeCOlumnsMode.AllCellsExceptHeader);
datagridview1.ReadOnly = true;
datagridview1.DataSource = bsBindingSource1;
Now how would I add a parameter to my SQL statement that is
string SQLString = "SELECT * From tableInformation WHERE ZIP = @ZIP";
Parameters.AddWithValue("@Zip", "39281");
Reply
Answers (
1
)
My task in Data Base Managment System Subject
Search record between from and todate and display in gridvie