日期:2014-05-18 浏览次数:20947 次
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace connectionDB
{
class Program
{
static void Main(string[] args)
{
OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Thesis\thesis programming\database\user1.mdb;Jet OLEDB:Engine Type=5");
cn.Open();
//OleDbCommand command = cn.CreateCommand();
OleDbDataAdapter adapter = new OleDbDataAdapter("select userNumber,inputVector,i,t,Bit,Top from hashValue", cn);
OleDbCommandBuilder comb = new OleDbCommandBuilder(adapter);
DataSet ds = new DataSet();
adapter.Fill(ds, "hashValue");
DataRow dr = ds.Tables["hashValue"].NewRow();
dr[0] = 11;
dr[1] = "1111111";
dr[2] = 22;
dr[3] = 33;
dr[4] = '1';
dr[5] = 44;
ds.Tables["hashValue"].Rows.Add();
adapter.Update(ds, "hashValue"); //[color=#FF0000]这里出错,说 INSERT INTO 语句的语法错误[/color]。
cn.Close();
Console.Read();
}
}
}