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
Senthil Gopi
NA
5
2.4k
How to define common odbc connection??
Oct 11 2012 2:31 AM
Hi
I'm new to .net , I'm creating a new windows application, i have 3 forms in it, all the forms will have related to database execution, so every time do i need to define same set of odbc connection or there any function to create it as common and can be called by the all the forms??
OdbcConnection dbcon = new OdbcConnection("Driver={IBM DB2 ODBC DRIVER};DBALIAS=TEST;Uid=db2admin;Pwd=xingmpeg;");
OdbcCommand cmd;
OdbcDataAdapter oda;
DataSet ds;
dbcon.Open();
string dbcmd = "Select * from tbl_login where u_name = '" + textBox1.Text + "'";
cmd = new OdbcCommand(dbcmd, dbcon);
oda = new OdbcDataAdapter();
ds = new DataSet();
oda.SelectCommand = cmd;
oda.Fill(ds);
dbcon.Close();
Reply
Answers (
4
)
chage the combobox item in datagridview by selecting another combobox item which is not in that datagridview
Bind combobox to datagridview