|
-
Dec 23rd, 2008, 01:19 AM
#1
Thread Starter
Lively Member
Excel Records using DSN
Dear Freinds
i m new with Excel. i m trying to retrieve data from EXCEL.
This code is not working gives me some error .Although OPenDb Procedure works fine. but when i call the Procedure GetRecord then error arises Microsoft jet database engine cannot find the input table.
Also how can i get the records from specific column. can insert records into the column,row.
Din Cn as new Adodb.connection
Dim ConString As String
Private Sub Command1_Click()
Call GetRecord
End Sub
Public Sub OpenDB()
ConString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=EX"
If Cn.State = 1 Then
Cn.Close
Else
Cn.Open ConString
End If
End Sub
Public Sub GetRecord()
Dim Rs As New ADODB.Recordset
Rs.ActiveConnection = Cn
Rs.Open "Select * from sheet1"
If Rs.EOF Then
MsgBox "No DATA"
Else
MsgBox Rs.Fields(1)
End If
End Sub
Private Sub Form_Load()
Call OpenDB
End Sub
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
|