What is wrong with this Dim for a SP w/parameters?

trend

Well-known member
Joined
Oct 12, 2004
Messages
171
Code:
Dim MyCommand As New OleDbCommand(("exec Write_Logins " & Date.Now.Date & "," & Date.Now.ToLongTimeString & "," & UsernameTry & "," & PasswordTry & ", " & TheirIP & "," & Payload & ""), MyConnection)

I get this error:
Failed to log attempt to db:Could not find stored procedure Write_Logins., Database Closed


I know Write_Login is there.. becuase i can run this query from Query Analyzer:
exec Write_Logins 1,1,1,1,1,1

and that works..

the Myconnection string worked when I didnt use stored procedures.


any ideas?
 
Code:
Dim MyCommand As New OleDbCommand(("exec Write_Logins 1,1,1,1,1,1"), MyConnection)
does it too...
 
Easy one.. sorta.

It just delt with SP and permissions.. So I just added the user to db admin, had him login and create the 2 SP.. and then go on the way.


But, my question is.. I tried changing permissions of the SP (I know i did..) and my user was even db admin, but I still couldnt execute the SP.

How can I get this working?


thanks
Lee
 
What database are you using?
Also if you are going to the trouble of using stored procs you really should look at using parameter objects rather than string concatenation to execute them.
 
hah.. sorry left that out..

MS SQL 2000

On win2k3 (..well that is my test environment.. the real server is win2k)
 
If you are using SQL you might be better off using the classes from System.Data.SqlClient rather than the OleDb ones.
Also under SQL object name resolution will vary depending on who owns / created it. e.g. if it was created by a user called trend then it would need to be called like
Code:
trend.Write_Logins
- this is one reason most objects are created with dbo as the owner.
 
Back
Top