|
-
Sep 8th, 2002, 02:20 PM
#1
Thread Starter
Junior Member
AutoFill Text Boxes
Hello All,
Anyone have a code for VB.net regarding AutoFilling TextBoxes or ComboBoxes with data froam an Access 2000 Database
Thanks in advance
-
Sep 8th, 2002, 04:32 PM
#2
Frenzied Member
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
Magiaus
If I helped give me some points.
-
Sep 8th, 2002, 04:37 PM
#3
Frenzied Member
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
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|