Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programatically Create a Stored Procedure...?
Message
From
17/05/2006 09:14:56
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
VB.NET 1.1
Miscellaneous
Thread ID:
01122634
Message ID:
01122655
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
Ben,

As Borislav said, you need to specify the database in the connection string. Here it is in .NET syntax:
"server=(local);database=MyDataBase;uid=sa;pwd=MyPassword"
~~Bonnie



>>>I am trying to create a Stored Procedure in a specified database programatically using the ExecuteNonQuery() method of an SQLCommand object. I am coming across a problem where the SP is being created in the Master Database because the "sa" account is being used. I attempted to preface my Create Procedure command with "USE ;" but SQL spits back that the Create Procedure command must be the first statement executed in a batch. How can I tell SQL to create this SP in the proper database?
>>
>>I am not very familiar with NET, but in VFP I use folowing technics: make a new connection to desired DataBase and then ExecuteNonQuery("CREATE SP......")
>
>Thank for the response, but like I said in my original posting, I already have the code to create the SP. What I need is a way to create the SP is the proper database.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform