using System.Data;
using System.Data.OleDb;
---------------------------
OleDbConnection thisConnection=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\D\DevCs\Works2\Person.mdb;");
thisConnection.Open();
OleDbCommand thisCommand=thisConnection.CreateCommand(); //
thisCommand.CommandText="SELECT * FROM Intro";
OleDbDataReader thisReader=thisCommand.ExecuteReader();
while(thisReader.Read())
{
Console.WriteLine("\t{0}\t{1}",thisReader["ID"],thisReader["TheName"]);
}
thisReader.Close();
thisConnection.Close();
--------------推广.NET应用,助力信息化中国(IsClever)
using System.Data.OleDb;
---------------------------
OleDbConnection thisConnection=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\D\DevCs\Works2\Person.mdb;");
thisConnection.Open();
OleDbCommand thisCommand=thisConnection.CreateCommand(); //
thisCommand.CommandText="SELECT * FROM Intro";
OleDbDataReader thisReader=thisCommand.ExecuteReader();
while(thisReader.Read())
{
Console.WriteLine("\t{0}\t{1}",thisReader["ID"],thisReader["TheName"]);
}
thisReader.Close();
thisConnection.Close();
--------------推广.NET应用,助力信息化中国(IsClever)
da.SelectCommand = cmd; DataSet ds = new DataSet(); OleDbConnection conn = new OleDbConnection("Provider=SQLOLEDB.1;Data Source=server;Initial Catalog=pubs;User ID=sa;password=");
string sql = "select * from employee";
cmd.CommandText = sql;
cmd.Connection = conn;
conn.Open();
cmd.ExecuteNonQuery(); da.Fill(ds); int i=0;
for(i=0;i<ds.Tables[0].Rows.Count;i++)
{
this.ListBox1.Items.Add(ds.Tables[0].Rows[i]["fname"].ToString());
}
conn.Close();
ADODB.ConnectionClass con = new ADODB.ConnectionClass();
ADODB.RecordsetClass rs = new ADODB.RecordsetClass();
怎么用??谢谢!