C # operation access

xiaoxiao2021-03-06  53

using System; using System.Data; using System.Data.OleDb; namespace ADONETWriteQuery {class Class1 {static void Main (string [] args) {string strDSN = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = mcTest. MDB "; string strsql =" INTO Developer (Name, Address "('newdressiinsert')"; // instantiate OLEDBCOMMAND object oledbconnection myconn = new OLEDBConnection (strDSN);

// Institute instant OLEDBCOMMAND object oledbcommand mycmd = new oledbcommand (strsql, myconn);

// Open the database, perform inserted SQL statement try {myconn.open (); mycmd.executenonquery (); console.writeline ("Successful insertion operation!");} Catch (Exception E) {Console.WriteLine ("in operation database Error in the process: / n {0} ", E.MESSAGE);} finally {myconn.close ();}}}}

转载请注明原文地址:https://www.9cbs.com/read-115672.html

New Post(0)