Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,836 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
//>>>>> this is the connection to sql
public partial class Form1 : Form
{
OleDbConnection con_sql = new OleDbConnection("Provider = sqloledb; Server=IT1038-109\\SQL_ABDELRAHMAN;Database=nana_db;Trusted_Connection=yes;");
//>>>>> this is the error button
private void button5_Click(object sender, EventArgs e)
{
con_sql.Open();
OleDbCommand cmd1 = con_sql.CreateCommand();
cmd1.CommandText = "select id,name,job,salary from info where id=@drr ";
//>>>>>>>>>>>>>>problem here
cmd1.Parameters.AddWithValue("@DRR ", textbox7.text);
OleDbDataReader reader5;
reader5 = cmd1.ExecuteReader();
if (reader5.Read())
{
textBox3.Text = reader5["id"].ToString();
textBox4.Text = reader5["name"].ToString();
textBox5.Text = reader5["job"].ToString();
textBox6.Text = reader5["salary"].ToString();
}
else
{
MessageBox.Show("wait ..");
}
MessageBox.Show("Record Submitted", "Congrats");
con.Close();
}