Is it possible to open a connection inside a windows service?Locked
Good day TR community! I created a windows service (vb.net) which reads the content of a DBF file table and import it to a MySQL table. The problem occurs at the line where I’m trying to open the connection between DBF and vb.net. Here’s the code I’ve been using:
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
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!