Showing posts with label vb6. Show all posts
Showing posts with label vb6. Show all posts

Wednesday, March 7, 2012

How to read from Sql express

Hi,

i have a program written in VB6 and writes without any problem in sql

express 2005 but when i try to Select information from SQL

to VB6 i always have a error " Object Required"

The link is ODBC Source with SQL NATIVE CLIENT

and the code is something like this

dbname = txtDb

Set Db = Ws.OpenDatabase(txtDb, False, False, "ODBC")

txtDb = Db.Name

logMessage = "Ligar a " & txtDb

UpdateLog (logMessage)

lblDbStatus = "Ligar"

picDbStatus.Visible = True

lblFileStatus = "Parado"

picFileStatusOff.Visible = True

tmr.Enabled = True

SQLStateQuery = "SELECT STATE FROM DYELOTS where dyelot = '" & Header(0) & "'"

Set rsState = Db.OpenRecordset(SQLStateQuery)

any one have a idea where is the problem

ThanksOk - ignore the text boxes and all that other stuff: can you just issue a SQL statement using your VB6 code without getting an error?


Check out my SQL Server 2005 Video Tutorials: http://www.learnsqlserver.com/