我要编一个网上考试系统,但是该怎么实现数据库与.net的连接呢?
赫赫,初学者,望各位多多指教。。
Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New System.Data.OleDb.OleDbConnection("Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source=" & System.Environment.CurrentDirectory & "\guild_item.mdb;Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False")
DS = New System.Data.DataSet
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select DISTINCT * from Dictionary", MyConnection)
MyConnection.Open()
MyCommand.Fill(DS)
MyConnection.Close()
DataGridView1.DataSource = DS.Tables(0)
VS2003里的MSDN