Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
how to display the information in gridview when item selected in combobox?
roy himanshu
Sep 7 2009 7:20 AM
4.3k
Reply
hi,
iam working in windows application in C#.if i select one item in combobox then immediatly that item information is displayed in gridview?how? i tryied but it is not working.my codeing past bellow.
private
void
comboBox1_SelectedIndexChanged(
object
sender,
EventArgs
e)
{
string s;
s = comboBox1.Text.ToString();
cn =
new
SqlConnection
(System.Configuration.
ConfigurationManager
.AppSettings[
"con"
]);
SqlCommand
cmd =
new
SqlCommand
(
"select * from CATABLE001 where column005=(select column001 from CATABLE005 where
column002='@COLUMN002'
)"
, cn);
da2 =
new
SqlDataAdapter
();
ds =
new
DataSet
();
cmd.Connection = cn;
da2.SelectCommand = cmd;
da2.Fill(ds,
"CATABLE001"
);
dataGridView1.DataSource = ds.Tables[0];
}
plz help me
thanx
himanshu
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
datagridview
How do you remotely connect to SQL Server Express Editions?