ADO.NET Connected Approach -


in connected approach while working databases, how add date string in table windows form date time picker?

always use property type, don't use string datetime. should use parameters prevent sql-injection:

using (var con = new sqlconnection(connectionstring)) {     using (var cmd = new sqlcommand("insert dbo.table(datecol)values(@date)", con))     {         cmd.parameters.add("@date", sqldbtype.datetime).value = datetimepicker1.value;         con.open();         cmd.executenonquery();     } } 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

React Native allow user to reorder elements in a scrollview list -

multithreading - Exception in Application constructor -