Guest_imported
New member
- Jan 1, 1970
- 0
Hello out there,
I am not so experienced in VB programming and have jumped up a step from programming applications for access. And now I am trying to make an application that shall read from an SQL-database and met the brick wall.
While surfing around on the net I found this site so now I am trying this to get some help.
Some information:
-The application I am trying to make will run on several computers therefore I want to use a ini-file that tells the program witch ODBC connection to use.
-I am trying to get the program running without using the VB’s data-envirement.
-I am using VB 6.0 pro.
When I am trying to run the code below it seems that the program don’t find the ini-file and it stops when it tryes to open the database.
Someone out there with a tips of how I can get the program running?
Option Explicit
Global KvalregDB As Database
Global Const INI_NAME = "READKVALREG.INI"
Global Const INI_DATABASE = "Database"
Global Const INI_KVALREG_DSN = "Kvalreg DSN"
Public Sub AapneDatabase()
Dim DSN As String
DSN = LesIniLinje(INI_DATABASE, INI_KVALREG_DSN, "ODBC;"
Set KvalregDB = OpenDatabase("", False, False, DSN)
End Sub
Public Function ReadIniLine(Section As String, Variable As String, Standard As String) As String
Dim Fname As String
Fname = App.Path + "\" + INI_NAME
End Function
My READKVALREG.INI
[Database]
Kvalreg DSN=ODBC;DSN=Readkval;uid=uid;pwd=pwd;
Thanks
Gaimi
gaimi@spray.no
I am not so experienced in VB programming and have jumped up a step from programming applications for access. And now I am trying to make an application that shall read from an SQL-database and met the brick wall.
While surfing around on the net I found this site so now I am trying this to get some help.
Some information:
-The application I am trying to make will run on several computers therefore I want to use a ini-file that tells the program witch ODBC connection to use.
-I am trying to get the program running without using the VB’s data-envirement.
-I am using VB 6.0 pro.
When I am trying to run the code below it seems that the program don’t find the ini-file and it stops when it tryes to open the database.
Someone out there with a tips of how I can get the program running?
Option Explicit
Global KvalregDB As Database
Global Const INI_NAME = "READKVALREG.INI"
Global Const INI_DATABASE = "Database"
Global Const INI_KVALREG_DSN = "Kvalreg DSN"
Public Sub AapneDatabase()
Dim DSN As String
DSN = LesIniLinje(INI_DATABASE, INI_KVALREG_DSN, "ODBC;"
Set KvalregDB = OpenDatabase("", False, False, DSN)
End Sub
Public Function ReadIniLine(Section As String, Variable As String, Standard As String) As String
Dim Fname As String
Fname = App.Path + "\" + INI_NAME
End Function
My READKVALREG.INI
[Database]
Kvalreg DSN=ODBC;DSN=Readkval;uid=uid;pwd=pwd;
Thanks
Gaimi
gaimi@spray.no