mad_girl
08-25-2007, 08:01 PM
hey experts, need some help here
the prob is this is my first time using visual basic and ADO so i got some errors in my codes which i can't work out
i'm sending the code now and i hope u tell me what i did wrong
__________________________________________________ ________
Dim adoConn As ADODB.Connection
Dim cmd As ADODB.Command
Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
End Sub
Private Sub addUser_Click()
Dim nou As Integer
cmd = New ADODB.Command
cmd.ActiveConnection = adoConn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "info"
cmd.Parameters.Append cmd.CreateParameter("id", adInteger, adParamInput, Val(refId.Text))
cmd.Parameters.Append cmd.CreateParameter("numOfUsers", adInteger, adParamOutput)
cmd.Execute
nou = cmd("numOfUsers")
If (nou = 3) Then
MsgBox "sorry,can't add more than 3 users under one referrer"
End If
End Sub
Private Sub Form_Load()
Dim constr As String
adoConn = New ADODB.Connection
adoConn.Provider = "SQLOLEDB.1"
adoConn.ConnectionString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=new;Data Source=np:MOHAMMED\SQLEXPRESS;Initial File Name=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\nEw.mdf"
adoConn.Open
End Sub
the prob is this is my first time using visual basic and ADO so i got some errors in my codes which i can't work out
i'm sending the code now and i hope u tell me what i did wrong
__________________________________________________ ________
Dim adoConn As ADODB.Connection
Dim cmd As ADODB.Command
Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
End Sub
Private Sub addUser_Click()
Dim nou As Integer
cmd = New ADODB.Command
cmd.ActiveConnection = adoConn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "info"
cmd.Parameters.Append cmd.CreateParameter("id", adInteger, adParamInput, Val(refId.Text))
cmd.Parameters.Append cmd.CreateParameter("numOfUsers", adInteger, adParamOutput)
cmd.Execute
nou = cmd("numOfUsers")
If (nou = 3) Then
MsgBox "sorry,can't add more than 3 users under one referrer"
End If
End Sub
Private Sub Form_Load()
Dim constr As String
adoConn = New ADODB.Connection
adoConn.Provider = "SQLOLEDB.1"
adoConn.ConnectionString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=new;Data Source=np:MOHAMMED\SQLEXPRESS;Initial File Name=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\nEw.mdf"
adoConn.Open
End Sub