Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-25-2007, 08:01 PM   PM User | #1
mad_girl
New Coder

 
Join Date: Aug 2007
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
mad_girl is an unknown quantity at this point
problem with vb ADO

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
mad_girl is offline   Reply With Quote
Old 08-25-2007, 08:11 PM   PM User | #2
PremiumBlend
Regular Coder

 
PremiumBlend's Avatar
 
Join Date: Apr 2006
Location: Marion, Iowa
Posts: 201
Thanks: 0
Thanked 13 Times in 13 Posts
PremiumBlend is an unknown quantity at this point
Have you defined the variable "adCmdStoredProc"?

cmd.CommandType expects an integer.
__________________
My Website: DumpsterDoggy
PremiumBlend is offline   Reply With Quote
Old 08-25-2007, 08:15 PM   PM User | #3
mad_girl
New Coder

 
Join Date: Aug 2007
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
mad_girl is an unknown quantity at this point
but adCmdStoredProc is a built in value
mad_girl is offline   Reply With Quote
Old 08-25-2007, 08:19 PM   PM User | #4
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Could you post what errors you are getting?
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 08-25-2007, 08:21 PM   PM User | #5
PremiumBlend
Regular Coder

 
PremiumBlend's Avatar
 
Join Date: Apr 2006
Location: Marion, Iowa
Posts: 201
Thanks: 0
Thanked 13 Times in 13 Posts
PremiumBlend is an unknown quantity at this point
I've had problems with this too. I've seen things where it is built in but I've found that implementation to be confusing. Have you tried just coding the value directly?

Here is a link to the values
__________________
My Website: DumpsterDoggy
PremiumBlend is offline   Reply With Quote
Old 08-25-2007, 08:25 PM   PM User | #6
mad_girl
New Coder

 
Join Date: Aug 2007
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
mad_girl is an unknown quantity at this point
ok i'm getting an error on each line of this code:
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

//object variable or with block variable not set
i put the declaration of adoConn in general declarations

cmd.ActiveConnection = adoConn
//object doesn't support method or property
mad_girl is offline   Reply With Quote
Old 08-25-2007, 08:26 PM   PM User | #7
mad_girl
New Coder

 
Join Date: Aug 2007
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
mad_girl is an unknown quantity at this point
PremiumBlend:
no actually i don know what values correspond to this property
mad_girl is offline   Reply With Quote
Old 08-25-2007, 09:00 PM   PM User | #8
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
try doing:

Code:
set adoConn = New ADODB.Connection
That might clear up the first error message.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 08-25-2007, 09:11 PM   PM User | #9
mad_girl
New Coder

 
Join Date: Aug 2007
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
mad_girl is an unknown quantity at this point
i did that but i had new error
Set adoConn.Provider="SQLOLEDB.1"
//invalid use of property
i knooow beginners are annoying
mad_girl is offline   Reply With Quote
Old 08-25-2007, 09:43 PM   PM User | #10
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
On that liine get rid of the 'set'.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 08-25-2007, 09:58 PM   PM User | #11
mad_girl
New Coder

 
Join Date: Aug 2007
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
mad_girl is an unknown quantity at this point
thank u sooo much this part worked and the connection came alive
hoping there would be no errors in the other parts
mad_girl is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:09 AM.


Advertisement
Log in to turn off these ads.