Question
Thread display: Collapse - |
All Answers
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Is it possible to open a connection inside a windows service?
Dim conn As OdbcConnection = Nothing
Dim comm As OdbcCommand = Nothing
Dim connectionString As String
Dim sql As String
connectionString = "DSN=dbfconn"
sql = SELECT * FROM TableName.DBF
conn = New OdbcConnection(connectionString)
conn.Open() --THIS IS WHERE THE PROBLEM OCCURS
comm = New OdbcCommand(sql, conn)
dr = comm.ExecuteReader()
InsertToMySQL --SUB ROUTINE FOR INSERTING dr TO MYSQL TABLE
conn.Close()
dr.Close()
comm.Dispose()
conn.Dispose()
These line of codes runs smoothly in a window based application (vb.net), but having problems when used in a windows service application (vb.net). I began to wonder if it's really possible to open a connection between DBF and VB.net inside a windows service.
Any help is highly appreciated. Thank you!