hi group!
i have problem with connection from client to sqlserver.
and what must i do?
thanks alot.:(Part from VB: open connection and call sp for update with parameters...
May be it is a little complicated for novice...
Dim MConnection As ADODB.Connection
Dim MCommand As ADODB.Command
Dim MRecordset As ADODB.Recordset
Dim MParameter As ADODB.Parameter
Set MConnection = CreateObject("ADODB.Connection")
Set MCommand = CreateObject("ADODB.Command")
LineConnect = "Provider=SQLOLEDB;Data Source=YourServer;UID=sa;PWD=sa"
MConnection.ConnectionString = LineConnect
MConnection.Open
With MCommand
.CommandText = "estore..UpdateLogin"
.ActiveConnection = MConnection
.CommandType = adCmdStoredProc
.Parameters.Append MCommand.CreateParameter("RetVal", adInteger, adParamReturnValue)
.Parameters.Append MCommand.CreateParameter("Id", adInteger, adParamInput, , 0)
.Parameters.Append MCommand.CreateParameter("username", adLongVarChar, adParamInput, 20, UName)
.Parameters.Append MCommand.CreateParameter("loginname", adLongVarChar, adParamInput, 128, LName)
.Parameters.Append MCommand.CreateParameter("password", adLongVarChar, adParamInput, 128, LPass)
.Parameters.Append MCommand.CreateParameter("usertypeid", adInteger, adParamInput, , UType)
End With
Set MRecordset = MCommand.Execute
If MRecordset.EOF Or MRecordset.BOF Then
.....................
another one:
Dim MConnection As ADODB.Connection
Dim MCommand As ADODB.Command
Dim MRecordset As ADODB.Recordset
Set MConnection = CreateObject("ADODB.Connection")
Set MCommand = CreateObject("ADODB.Command")
LineConnect = "Provider=SQLOLEDB;Data Source=ServerName;UID=sa;PWD="
MConnection.ConnectionString = LineConnect
MConnection.Open
With MCommand
.CommandText = "select ... or call SP"
.ActiveConnection = MConnection
.CommandType = adCmdText
End With
Set MRecordset = MCommand.Execute
If MRecordset.EOF Or MRecordset.BOF Then
.....................
No comments:
Post a Comment