Hello All,
Anyone have a code for VB.net regarding AutoFilling TextBoxes or ComboBoxes with data froam an Access 2000 Database
Thanks in advance
Printable View
Hello All,
Anyone have a code for VB.net regarding AutoFilling TextBoxes or ComboBoxes with data froam an Access 2000 Database
Thanks in advance
yeah sure.
make an OleDbConnection, make an OleDbCommand, rite some sql to get the data you need then use the command to call it...
like so
VB Code:
Option Explicit On Option Strict On Module OleDb Public Sub Main() DoIt() End Sub Public Sub DoIt() Dim db As New System.Data.OleDb.OleDbConnection() Dim dbCmd As New System.Data.OleDb.OleDbCommand() Dim Form As New System.Windows.Forms.Form() Dim i As System.Int32 db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.Windows.Forms.Application.StartupPath() & "\mDb.mdb;" MsgBox(db.ConnectionString()) db.Open() For i = 1 To 3 Form = New System.Windows.Forms.Form() dbCmd.Connection = db dbCmd.CommandText = "Select FormCaption From blah Where ID=" & CStr(i) & ";" Form.Text = CStr(dbCmd.ExecuteScalar()) Form.Show() Form = Nothing Next End Sub End Module
database is in attached zip
you will most likely want to use the DataReader though i posted an example of that on here already but it apears to have been purged