Andy78
Nov 24th, 2006, 03:45 AM
I've developed an application which has the following code for a command button. It is used to query an ADODC bound to a datagrid control. It runs fine on my machine but when run on another machine the data is not showing in the control and it comes up with the error message above when you click this button. I've copied all other files across with the 'exe' file. Does anybody know what the problem could be?
Private Sub Clear_login_Click()
Dim Clear_login_msg As Integer
Dim User_cleared_msg As Variant
Dim Conn1 As New ADODB.Connection
Dim Cmd1 As New ADODB.Command
Dim Rs1 As New ADODB.Recordset
Dim SQL_Connect As String
Dim luserID As Integer
Dim ldatabase As String
luserID = Adodc1.Recordset!userid
ldatabase = Adodc1.Recordset!DatabaseName
SQL_Connect = "Provider=SQLOLEDB.1;" & _
"Password=***;" & _
"Persist Security Info=True;" & _
"User ID=***;" & _
"Initial Catalog=TSSecurity;" & _
"Data Source=***;"
Clear_login_msg = MsgBox("Do you wish to clear the user?", vbYesNo + vbExclamation, "")
If Clear_login_msg = 6 Then
Conn1.ConnectionString = SQL_Connect
Conn1.Open
Cmd1.ActiveConnection = Conn1
Cmd1.CommandText = "UPDATE TSSecurity.dbo.ts_usersec SET userloggedin = ' '" & _
"WHERE TSSecurity.dbo.ts_usersec.userid = " & luserID & _
"AND TSSecurity.dbo.ts_usersec.databasename = '" & ldatabase & "'"
Set Rs1 = Cmd1.Execute
Adodc1.Refresh
User_cleared_msg = MsgBox("The user has been cleared", vbOKOnly, "")
Conn1.Close
Conn1.ConnectionString = " "
Else
End If
Private Sub Clear_login_Click()
Dim Clear_login_msg As Integer
Dim User_cleared_msg As Variant
Dim Conn1 As New ADODB.Connection
Dim Cmd1 As New ADODB.Command
Dim Rs1 As New ADODB.Recordset
Dim SQL_Connect As String
Dim luserID As Integer
Dim ldatabase As String
luserID = Adodc1.Recordset!userid
ldatabase = Adodc1.Recordset!DatabaseName
SQL_Connect = "Provider=SQLOLEDB.1;" & _
"Password=***;" & _
"Persist Security Info=True;" & _
"User ID=***;" & _
"Initial Catalog=TSSecurity;" & _
"Data Source=***;"
Clear_login_msg = MsgBox("Do you wish to clear the user?", vbYesNo + vbExclamation, "")
If Clear_login_msg = 6 Then
Conn1.ConnectionString = SQL_Connect
Conn1.Open
Cmd1.ActiveConnection = Conn1
Cmd1.CommandText = "UPDATE TSSecurity.dbo.ts_usersec SET userloggedin = ' '" & _
"WHERE TSSecurity.dbo.ts_usersec.userid = " & luserID & _
"AND TSSecurity.dbo.ts_usersec.databasename = '" & ldatabase & "'"
Set Rs1 = Cmd1.Execute
Adodc1.Refresh
User_cleared_msg = MsgBox("The user has been cleared", vbOKOnly, "")
Conn1.Close
Conn1.ConnectionString = " "
Else
End If