open a new form that will added to an existing one...
Hi all,
I am relatively new to .NET and C#.
I am trying to open an additional (new) form when a button is clicked on an already existing form, but i want that this winform will be added to the first winform (from Basic to advanced window).
How do i do this?
Thanks in advance
Answers (2)
0
Hi,
Try this Code :
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=DBNAME;Integrated Security=true;");
SqlDataReader dr;
SqlCommand cmd;
try
{
con.Open();
string qry ="select * from table where username ='"+textbox1.Text+"'";
cmd = SqlCommand(qry,con);
dr = cmd.ExecuteReader();
while(dr.read())
{
//do something
MessageBox.Show("UserName:"+dr.GetString(0));
}
dr.Close();
con.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.message);
}
finally
{
con.Close();
}
Accepted 0
i think you are wishing to search out the record when user type in textbox and clicks button, isn't it? if so then read a article which let u find record from database
read this