Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Sql Server 2000 Connection String not working...

Status
Not open for further replies.

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.
 
well my inital thought is you didn't give a specific user and password in your connection string. You can't connect without that. And DO not allow this app to use Sa with no password under any circumstances as that is not secure.

You do know you can get a free version of SQL Server or a development version that only costs $50? SQL server code is not always ANSI compliant and there are ways that you can do things more effectively in SQL Server using code specific to SQL Server.

"NOTHING is more important in a database than integrity." ESquared
 
... yea I figured that was it but i didnt have a way of getting the password.. thanks :)
 
Yeah, hacking a server isn't as easy as it used to be.... ;-)

< M!ke >
I am not a hamster and life is not a wheel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top