For this code you have to use SqlServerCe
using System.Data.SqlServerCe;
public void Insert() { using (SqlCeConnection ceConn = new SqlCeConnection("Data Source=SQLCEDB.sdf")) { using (SqlCeCommand ceComm = new SqlCeCommand ("INSERT INTO TABLENAME (FIELD1,FIELD2,FIELD3) VALUES (@VAL1,@VAL2,@VAL3)")) { ceComm.Parameters.Add("@VAL1", System.Data.SqlDbType.NVarChar).Value = "VAL1"; ceComm.Parameters.Add("@VAL2", System.Data.SqlDbType.NVarChar).Value = "VAL2"; ceComm.Parameters.Add("@VAL3", System.Data.SqlDbType.NVarChar).Value = "VAL3"; ceComm.Connection = ceConn; ceComm.CommandType = System.Data.CommandType.Text; ceComm.ExecuteNonQuery(); } } }
|
No responses found. Be the first to respond and make money from revenue sharing program.
|