How do I display the data I retrive from a microsoft access database into a textbox in VB.NET?
Printable View
How do I display the data I retrive from a microsoft access database into a textbox in VB.NET?
something like this
VB Code:
Dim cn As New OleDbConnection() Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=d:/northwind.mdb" cn.Open() Dim cm As New OleDbCommand("select companyname from customers where customerid='alfki'", cn) TextBox1.Text = CType(cm.ExecuteScalar, String) cn.Close() End Sub
Thanks a lot. I tried seatching on the net but a lot of example are meant for web based development, not desktop application
Did it work?Quote:
Originally posted by Buaya_hunter
Thanks a lot. I tried seatching on the net but a lot of example are meant for web based development, not desktop application
It works very well for my purpose
Hi,
The reason why I asked was that I had to use
Dim cn As New Oledb.OleDbConnection()
Dim cm As New Oledb.OledbCommand
imports system.data.oledb
Thank you:wave:Quote:
Originally posted by brown monkey
imports system.data.oledb