openConnection(); string query = "insert into votes ([time],[V1],[V2],[V3]) values (@time,@V1,@V2,@V3)"; SqlCommand cmd2 = new SqlCommand(query, con); cmd2.Parameters.Add(new SqlParameter("@time", DateTime.Now.ToShortTimeString())); cmd2.Parameters.Add(new SqlParameter("@V1", selCand_No1)); cmd2.Parameters.Add(new SqlParameter("@V2", selCand_No2)); cmd2.Parameters.Add(new SqlParameter("@V3", selCand_No3)); cmd2.ExecuteNonQuery(); MessageBox.Show("Succesfully Inserted"); closeConnection();
Try this it returns you only time from whole format mydate is my datetime column in the table employee. select convert(nvarchar,mydate,8) from employee thanks
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)