[dba-SQLServer] SQL Server 2005: Running stored procedures from C# / VBA

jwcolby jwcolby at colbyconsulting.com
Mon Nov 2 07:58:56 CST 2009

I am embarking on the task of running the "DB from hell" from C#.  I have several dozen stored 
procedures that perform various tasks and I currently run many of them from Access using a single 
procedure provided by Charlotte.  I need a similar function written in C# (preferably) or VB.Net.

ATM I have an Access database which has two specific forms, bound to two tables.  These two forms 
each execute a set of SPs which build temp tables of data to be exported to an external process, 
build indexes to make the processes faster, BCP the data out to CSV files, and then the reverse on 
the way back in.

I have another Access database that creates an order for the same client.  Same kind of thing, temp 
tables created, indexes, fields added and so forth.

My intention is to port each of these processes to C#.  The reason is simply that C# has a couple of 
huge advantages over VBA, such as child threads and built-in capabilities in the framework that I 
have to really scrounge to make work in VBA.

The first thing I need though is code that can execute a stored procedure, pass parameters to it, 
retrieve parameters back etc.  With demo code preferably.

Also I would like to open a conversation about how using .Net from inside of SQL Server (2005) 
works.  Does anyone on the list use C# or VB.Net from inside of SQL Server?  Where is the code 
stored?  How to do you call it?  What do you use it for?


John W. Colby

More information about the dba-SQLServer mailing list