-
1 Attachment(s)
Stored Procedures
i m writting an application in which i add,delete and edit the records
i m using sql server
i have one table called Contacts in the database and few stored procedures in the database
i have method RetreiveContacts()
Code:
Private Sub RetrieveContacts()
Dim conn As New SqlConnection(My.Settings.AddressBookConnection)
Dim adapter As New SqlDataAdapter("Contacts_AllContacts_Select", conn)
Dim dt As New DataTable("Contacts")
adapter.Fill(dt)
dgContacts.DataSource = dt
End Sub
when i run my project ...error comes on following line
and error says"Could not find stored procedure 'Contacts_AllContacts_Select'"
but i have added this stored procedure into the database
i m attaching code and database files,kindly tell me the solution
thanks
-
Re: Stored Procedures
Maybe you need a 'CALL' before your procedure name.
i.e Dim adapter As New SqlDataAdapter("CALL Contacts_AllContacts_Select", conn)
Thats the way it is in MySQL.
Does it work from enterprise manager?
-
Re: Stored Procedures
I will look at your Project Tomorow when i get to the Office. now i need to ask you some few questions about what i see in your Code
The SP "Contacts_AllContacts_Select", Who owns the Sp, For an Exampel , if you call a SP that is Owned by the different user just like that , well SQL is supposed to tell you that the SP does not Exists. try to put a User of the SP like this
Code:
dbo.Contacts_AllContacts_Select
To fid out who is the Owner of the SP, in your management Studio , Go to Database, digg below Programibility and choose the StoredProcedure and in the StoredProcedure, look for you Sp "Contacts_AllContacts_Select", Check the Prefix of the SP. If i helped rate me. :)