|
-
Aug 15th, 2001, 09:06 PM
#1
Thread Starter
Lively Member
How to open a table in a database and view them in a textbox using ADO?
Firstly, I'm new to VB and using ADO.
I have a database 'sample.mdb'. This database contain a table 'test1'.
Here is how I open the database:
/* Start code here
Private Sub Form_Load()
Dim cLocation As String, SQLstmt As String
Dim adodc1 As New ADODB.Connection
Dim rs1 As New ADODB.Recordset
cLocation = "c:\sample.mdb"
adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB atabase Password=my_password_here;" & _
"Data Source=" & cLocation & ";" & _
"Persist Security Info=False"
adodc1.CommandTimeout = 15
adodc1.Open
Set rs1 = New ADODB.Recordset
Set rs1 = adodc1.Execute("Select * from test1 order by mykeyid", , adCmdText)
' adodc1.CommandType = adCmdTable
End Sub
*/ End Code here
It seem that the progrom startup okay but nothing appear on my form.
If I change the format to using 'data' icon form toolbox tag, the form shown whatever i want. Because my access database is password protected, I can't use the 'data' format - 'Invalid password' message appear.
Hope someone can provide me some idea here.
Thanks.
-
Aug 16th, 2001, 01:23 AM
#2
New Member
What about your textboxes?
you said you wanted to display your tsable in textboxes your code seems to be ok .... did you connect your textboxes right like properties? datasource, datamember etc...
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
|