Query
-
insert into dashboarddealerlogin (logoutdatetime) values (GETDATE()) It is giving error : Cannot insert value null in logoutdatetime. Anywaz, let it b. Just c this : private void logout_Click(object sender, EventArgs e) { conn.Open(); string strQury = ""; strQury = "insert into dashboarddealerlogin (logoutdatetime) values '(" + DateTime.Now + ")'"; SqlCommand cm = new SqlCommand(strQury, conn); int n = Convert.ToInt32(cm.ExecuteScalar()); } I have written this code in form1.cs n i have to write it here only. Now i want to use this 'int n' in a function in form2.cs funEntrylogin(m, i, tb_id.Text, tb_pswd.Text, DateTime.Now,n); but here it is giving error on 'n'. how can i do this? thanx. nekshan.
-
insert into dashboarddealerlogin (logoutdatetime) values (GETDATE()) It is giving error : Cannot insert value null in logoutdatetime. Anywaz, let it b. Just c this : private void logout_Click(object sender, EventArgs e) { conn.Open(); string strQury = ""; strQury = "insert into dashboarddealerlogin (logoutdatetime) values '(" + DateTime.Now + ")'"; SqlCommand cm = new SqlCommand(strQury, conn); int n = Convert.ToInt32(cm.ExecuteScalar()); } I have written this code in form1.cs n i have to write it here only. Now i want to use this 'int n' in a function in form2.cs funEntrylogin(m, i, tb_id.Text, tb_pswd.Text, DateTime.Now,n); but here it is giving error on 'n'. how can i do this? thanx. nekshan.
already replyed see belowed