Monday, 15 March 2010

sql - MS Access DataTime field (General Date) insert query -


I have a generic DAL query, which was not able to insert the date. But now I want to edit it but how do I get involved? I tried it as string, convert (), format () .. Anything, still I cant seem to find how to do it. It should be a normal format (which is DD / MM / YYYYHH: MM: SS (24D)) but I am unable to find it correctly. Public static Zero AddRow (string TableName, Object [] value) {DataTable dt = OleDbhelper.fill ("SELECT TOP 1 * FROM" + TableName); If (dt.Columns.Count - 1 == values.Length) {string sql = "INSERT INTO" + + Table Name + "(for (int i = 1; i & lt; dt.Column.Count; i + +) {SQL + = "[" + Dt.Columns [i] .columnName + "]; if (i! = Dt.Column.Count-1) sql + =", "; else sql + =") " ;} For Sql + = "VALUES ("; (int i = 0; i

Any ideas? P> / div>

If this is in use, then use it:

  sql + = values [I] .tostring ("# 'Yyyy /' MM '/' dd hh ':' mm ':' s '#'");  

No comments:

Post a Comment