Please Help Friends,
namespace VERS
{
public class ConnectionClass
{
public OleDbConnection conn;
public OleDbCommand cmd;
private OleDbDataAdapter da;
private DataTable dt;
public OleDbDataReader d2;
public DataSet DataSet;
public string path ;
public void Myoledbconnection()
{
LoginForm l = new LoginForm();
conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\1\VERS\versdb.accdb ");
conn.Open();
}
public void oledbquery(string quertext)
{
Myoledbconnection();
cmd = new OleDbCommand(quertext, conn);
}
public DataTable queryex()
{
da = new OleDbDataAdapter(cmd);
dt = new DataTable();
da.Fill(dt);
return dt;
}
public void nonqueryex()
{
cmd.ExecuteNonQuery();
conn.Close();
}
}
}
But
1) Update for the following code is not working
private void BtnUpdate_Click(object sender, EventArgs e)
{
if (txtUserName.Text != "" && txtPassword.Text != "")
{
con = new ConnectionClass();
con.oledbquery("update tbluser set id=@id,userlogin = @userName,password = @password where id = @id");
con.cmd.Parameters.AddWithValue("@id", textBox1.Text.ToString());
con.cmd.Parameters.AddWithValue("@userName", txtUserName.Text.ToString());
con.cmd.Parameters.AddWithValue("@password", txtPassword.Text.ToString());
con.nonqueryex();
MessageBox.Show("Record Updated Successfully");
DisplayData();
ClearData();
}
else
{
MessageBox.Show("Please Select Record to Update");
}
}

2) count for the following code is display Nothing when I add year between TextBox1.Text and TextBox2.Text
con = new ConnectionClass();
con.Myoledbconnection();
//current
con.oledbquery("SELECT COUNT([sex]) FROM [birth table] where calculate >=0 and calculate <=90 and [palce 111] ='city' and [sex] ='male' and year between TextBox1.Text and TextBox2.Text ");
Int32 count_1 = (Int32)con.cmd.ExecuteScalar();