irenavassilia
Programmer
- Jun 19, 2007
- 101
Hi Everyone,
I am trying to connect to Microsoft Sql Server 2000 with in my Visual Basic 6 application, I cannot test it on my computer because I dont have sql server i have Pervasice.
So I am testing out the program on the Virtual PC where my client has Microsoft SQL Server 2000, however my program doesnt seem to want to open the connection, please help
Here is my code:
Dim str As String
Dim strInsertUser As String
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As ADODB.Recordset
Dim sConnString As String
'----------------------------------------------------------------------------------------------------------------------
Dim Session As New ACCPACSession
Dim Signon As New AccpacSignonMgr
Dim strFilter As String
'----------------------------------------------------------------------------------------------------------------------
Dim UserID As String
'----------------------------------------------------------------------------------------------------------------------
Session.Init "", "PO", "PO1210", "54A"
Session.Open "ADMIN", "ADMIN", "SAMLTD", Date, 0, 0
'----------------------------------------------------------------------------------------------------------------------
UserID = Signon.Signon(Session)
UserID = Session.UserID
'----------------------------------------------------------------------------------------------------------------------
'Call modDatabase.SetDatabase(cnn, pcintConnType_DB)
sConnString = "Provider=sqloledb;" & _
"Data Source=(local);" & _
"Initial Catalog=SAMLTD;" & _
"User Id=;" & _
"Password="
MsgBox sConnString
'Open Connection String
conn.Open sConnString
MsgBox "Opened connection"
'Execute connection string
Set cmd.ActiveConnection = conn
MsgBox "ActiveConnection"
'Insert User name into POPORH1/Comment field
str = "UPDATE POPORH1 SET COMMENT = '" & UserID & "' WHERE PONUMBER = '" & strPONumber & "'"
'Run Query
cmd.CommandText = str
cmd.CommandType = adCmdText
'Execute Query
Set rs = cmd.Execute
MsgBox "executed"
Any help will be greatly appreaciated! thanks a bunch.
I am trying to connect to Microsoft Sql Server 2000 with in my Visual Basic 6 application, I cannot test it on my computer because I dont have sql server i have Pervasice.
So I am testing out the program on the Virtual PC where my client has Microsoft SQL Server 2000, however my program doesnt seem to want to open the connection, please help
Here is my code:
Dim str As String
Dim strInsertUser As String
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As ADODB.Recordset
Dim sConnString As String
'----------------------------------------------------------------------------------------------------------------------
Dim Session As New ACCPACSession
Dim Signon As New AccpacSignonMgr
Dim strFilter As String
'----------------------------------------------------------------------------------------------------------------------
Dim UserID As String
'----------------------------------------------------------------------------------------------------------------------
Session.Init "", "PO", "PO1210", "54A"
Session.Open "ADMIN", "ADMIN", "SAMLTD", Date, 0, 0
'----------------------------------------------------------------------------------------------------------------------
UserID = Signon.Signon(Session)
UserID = Session.UserID
'----------------------------------------------------------------------------------------------------------------------
'Call modDatabase.SetDatabase(cnn, pcintConnType_DB)
sConnString = "Provider=sqloledb;" & _
"Data Source=(local);" & _
"Initial Catalog=SAMLTD;" & _
"User Id=;" & _
"Password="
MsgBox sConnString
'Open Connection String
conn.Open sConnString
MsgBox "Opened connection"
'Execute connection string
Set cmd.ActiveConnection = conn
MsgBox "ActiveConnection"
'Insert User name into POPORH1/Comment field
str = "UPDATE POPORH1 SET COMMENT = '" & UserID & "' WHERE PONUMBER = '" & strPONumber & "'"
'Run Query
cmd.CommandText = str
cmd.CommandType = adCmdText
'Execute Query
Set rs = cmd.Execute
MsgBox "executed"
Any help will be greatly appreaciated! thanks a bunch.