I have created a login form for connecting vb6 to oracle .The following code I have wrote in click event of button login.
Private Sub cmdlogin_Click()
Dim con As New ADODB.Connection
Dim constr As String
Dim username As String
Dim pwd As String
username = Trim(txtusrname.Text)
pwd = Trim(txtpwd.Text)
constr = "provider = MSDAORA;user id = username; password = pwd;"
con.Open constr
If con.State = adStateOpen Then
MsgBox ("oracle connected")
Else
MsgBox ("oracle not connected")
End If
End Sub
Here , we are taking username and pwd from user. when I run program I get error saying ""username or pwd invalid. but when I alter the code and use below code I get correct output why ? what is the reason ?
Private Sub cmdlogin_Click()
Dim con As New ADODB.Connection
Dim constr As String
constr = "provider = MSDAORA;user id = system; password = system;"
con.Open constr
If con.State = adStateOpen Then
MsgBox ("oracle connected")
Else
MsgBox ("oracle not connected")
End If
End Sub