Hi there, I've used the following function as part of a code to connect my vb.net application to sql server 2000. However, the underlined code below (at the while statement) says: "Operator '=' is not defined for types 'System.Data.Sq lClient.SqlConn ection' and 'System.Data.Sq lClient "
What is wrong with it?
Thank you,
Public Shared Function ManiCon() As SqlConnection
servername = CType(GetSystem Setting("Server ", ""), String)
database = CType(GetSystem Setting("Databa se", ""), String)
username = CType(GetSystem Setting("Userna me", ""), String)
password = CType(GetSystem Setting("Passwo rd", ""), String)
Dim con As SqlConnection
Dim cs As OAMS.Common.Con nctionSetting = New OAMS.Common.Con nctionSetting()
While (con = connect(servern ame, database, username, password)) Is Nothing
If (connect(server name, database, username, password)) Is Nothing Then
If cs.ShowDialog() = System.Windows. Forms.DialogRes ult.OK Then
Return Nothing
End If
servername = cs.Server
database = cs.Database
username = cs.Username
password = cs.Password
End If
SetSystemSettin g("Server", servername)
SetSystemSettin g("Database", database)
SetSystemSettin g("Username", username)
SetSystemSettin g("Password", password)
End While
Return con
End Function
What is wrong with it?
Thank you,
Public Shared Function ManiCon() As SqlConnection
servername = CType(GetSystem Setting("Server ", ""), String)
database = CType(GetSystem Setting("Databa se", ""), String)
username = CType(GetSystem Setting("Userna me", ""), String)
password = CType(GetSystem Setting("Passwo rd", ""), String)
Dim con As SqlConnection
Dim cs As OAMS.Common.Con nctionSetting = New OAMS.Common.Con nctionSetting()
While (con = connect(servern ame, database, username, password)) Is Nothing
If (connect(server name, database, username, password)) Is Nothing Then
If cs.ShowDialog() = System.Windows. Forms.DialogRes ult.OK Then
Return Nothing
End If
servername = cs.Server
database = cs.Database
username = cs.Username
password = cs.Password
End If
SetSystemSettin g("Server", servername)
SetSystemSettin g("Database", database)
SetSystemSettin g("Username", username)
SetSystemSettin g("Password", password)
End While
Return con
End Function
Comment