troubleshooting Question

Vb6 in SqlServer 2008

Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla asked on
Microsoft SQL ServerVisual Basic ClassicVB Script
3 Comments2 Solutions379 ViewsLast Modified:
Hi! experts
I have vb6 project using msqlserver 7. I want this project use sqlserver 2008. How?
here is my existing Codes;
 in form1

Private Sub Command1_Click()
Dim s As DBAccess
Set s = New DBAccess
s.OPEN_CON "xDB", "MYNOTEBOOK"

    s.Save_PassWord txtUsrName.Text, txtPassWord.Text

s.CLOSE_CON
Set s = Nothing
MsgBox "Saved"
End Sub

In Class Modules code are;

Option Explicit
Dim cn As ADODB.Connection
Public Sub OPEN_CON(db As String, ServerName As String)

Set cn = New ADODB.Connection
cn.Provider = "sqloledb"
cn.ConnectionTimeout = 25
cn.Properties("Data source").Value = Trim(ServerName)
cn.ConnectionString = ""
cn.Properties("Initial Catalog").Value = db
cn.Properties("User ID").Value = "sa"
cn.CursorLocation = adUseClient
cn.Open

End Sub
Public Sub CLOSE_CON()
If cn.State = adStateOpen Then
    cn.Close
End If
Set cn = Nothing
End Sub


Public Sub Save_PassWord(iUsrName As String, iPassWord As String)
    cn.Execute ("Insert Into Users (Usr_Name,Pass_Word) values (" & _
    Trim(iUsrName) & ",'" & iPassWord & "')")
End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros