SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Call Procedure in Visual Basic


Call Procedure in Visual Basic

Author
Message
Eric belair
Eric belair
Grasshopper
Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)

Group: General Forum Members
Points: 10 Visits: 1

Hi everybody,

i swear someone can help me here

i'm trying to call stored procedure......here is my code

' Connect to the data source using the Open

' method of an ADODB.Connection object..

Dim con As New ADODB.Connection

con.Open("provider = .NET Framework Data Provider for SQL Server")

con.string = "productid.mdf;Initial Catalog=Product;Integrated Security=True;Pooling=False;uid=uid;pwd=pwd "

' Create an ADODB.Command object that uses the

' connection object "con", and calls the stored

' procedure named "proc1"..

Dim cmd As New ADODB.Command

cmd.ActiveConnection = con

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "insertcustomer"

' Call the stored procedure..

cmd.Execute()

' Disconnect from the data source..

con.Close()

End Sub

and i have an error when i run it they error is

"Provider cannot be found. It may not be properly installed."

anyone here have isssue how to resolve this bug

Thanks you


FP-401493
FP-401493
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 4
The correct driver name is "Provider = SQLNCLI" for dot net native driver for sql server.

Instead of using connection string, put directly in the open() method.

con.Open("Provider = SQLNCLI;Data Source = myserver; Database=mydb;", "user", "password")

Please use this and let me know if you have a problem ... Thanks.

FP







FP





True Love is Like A Ghost. Everyone Talks About It & Nobody have seen it.
Eric belair
Eric belair
Grasshopper
Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)

Group: General Forum Members
Points: 10 Visits: 1

thanks grooshopper but i resolve my probleme here my code is now

Dim sqlcon As New SqlClient.SqlConnection

sqlcon.ConnectionString = "Data Source=WISEMAN\SQLEXPRESS;Initial Catalog=Productdetail;Integrated Security=True;Pooling=False;uid=uid;pwd=pwd "

Dim cmd As New SqlClient.SqlCommand

cmd.Connection = sqlcon

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "insertcustomer"

cmd.Parameters.AddWithValue("@detail", TextBox2.Text)

sqlcon.Open()

cmd.ExecuteScalar()

sqlcon.Close()

and now it work fine for my delete,update,and insert Procedure

thanks you for the help


FP-401493
FP-401493
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 4
Thanks. Happy SQL-ing =)







FP





True Love is Like A Ghost. Everyone Talks About It & Nobody have seen it.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search