a query. [modified]
-
When i logout, i want that 'logoutdatetime' in database,its format is datetime in database. So i have written query, but it is giving error. strQury = "insert into dashboarddealerlogin (logoutdatetime) values '" + DateTime.Now + "'; what is wrong? If u can plz guide. And.. lasttime nu : str = str1 + "#" + str2 + "#" + str3 ...barobar implement nai thayu haji,i'll try it 2mrw now. thanx nekshan -- modified at 5:20 Monday 19th February, 2007
-
When i logout, i want that 'logoutdatetime' in database,its format is datetime in database. So i have written query, but it is giving error. strQury = "insert into dashboarddealerlogin (logoutdatetime) values '" + DateTime.Now + "'; what is wrong? If u can plz guide. And.. lasttime nu : str = str1 + "#" + str2 + "#" + str3 ...barobar implement nai thayu haji,i'll try it 2mrw now. thanx nekshan -- modified at 5:20 Monday 19th February, 2007
What is the format of the date you wish to store in the database??
Thanking you in Advance Regards Pratik Shah
-
When i logout, i want that 'logoutdatetime' in database,its format is datetime in database. So i have written query, but it is giving error. strQury = "insert into dashboarddealerlogin (logoutdatetime) values '" + DateTime.Now + "'; what is wrong? If u can plz guide. And.. lasttime nu : str = str1 + "#" + str2 + "#" + str3 ...barobar implement nai thayu haji,i'll try it 2mrw now. thanx nekshan -- modified at 5:20 Monday 19th February, 2007
strQury = "insert into dashboarddealerlogin (logoutdatetime) values '(" + DateTime.Now + ")';"
-
strQury = "insert into dashboarddealerlogin (logoutdatetime) values '(" + DateTime.Now + ")';"
-
Incorrect syntax near : '(" + DateTime.Now + ")' I m checking it in query analyser. nekshan.
insert into dashboarddealerlogin (logoutdatetime) values (GETDATE()) write this in query bilder.
-
When i logout, i want that 'logoutdatetime' in database,its format is datetime in database. So i have written query, but it is giving error. strQury = "insert into dashboarddealerlogin (logoutdatetime) values '" + DateTime.Now + "'; what is wrong? If u can plz guide. And.. lasttime nu : str = str1 + "#" + str2 + "#" + str3 ...barobar implement nai thayu haji,i'll try it 2mrw now. thanx nekshan -- modified at 5:20 Monday 19th February, 2007
Nekshan wrote:
strQury = "insert into dashboarddealerlogin (logoutdatetime) values '" + DateTime.Now + "'; what is wrong?
You have forgotten the parenthesis around the values, and you have forgotten to convert the DateTime value into a string: strQury = "insert into dashboarddealerlogin (logoutdatetime) values ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'); You should make sure that the date format that you use is understood correctly by the database. I prefer the ISO 8601 date format as it's unambigous.
--- single minded; short sighted; long gone;
-
Incorrect syntax near : '(" + DateTime.Now + ")' I m checking it in query analyser. nekshan.
u test query in sql query bilder but system.datatime.now() is a function of vb.net so its not run in builder but code i sent u is correct '(" + DateTime.Now + ")'
-
When i logout, i want that 'logoutdatetime' in database,its format is datetime in database. So i have written query, but it is giving error. strQury = "insert into dashboarddealerlogin (logoutdatetime) values '" + DateTime.Now + "'; what is wrong? If u can plz guide. And.. lasttime nu : str = str1 + "#" + str2 + "#" + str3 ...barobar implement nai thayu haji,i'll try it 2mrw now. thanx nekshan -- modified at 5:20 Monday 19th February, 2007
Nekshan wrote:
...barobar implement nai thayu haji,i'll try it 2mrw now.
:confused:
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos
-
insert into dashboarddealerlogin (logoutdatetime) values (GETDATE()) write this in query bilder.
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.
'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()); '} 'above query is correct.return value for n is (0 or 1) if n=0 then not row update and n=1 then row updated. error is on something else.