Visual Studio Development Bookmark and Share   
 index > Visual C# Express Edition > saved SQL queries
 

saved SQL queries

I'm new to C#, so I apologize in advance.

How can I utilize SQL queries that are already associated with my SQL Server 2005 installation.  I have a windows form app that I'm trying to make a user-interface that calls the already saved queries.

I was just looking into stored procedures, but I'm not sure if that's the way to go.

Any advice would be greatly appreciated.  Thank you very much in advance.
zbix  Monday, October 05, 2009 5:17 PM
Hi,

You can try to create a Stored Procedures in the query , and call the Stored Procedures from c# code.

Please take a look at the artical about how to create Stored Procedures:
http://msdn.microsoft.com/en-us/library/aa174792(SQL.80).aspx

Or you can excute the query from c# code directly , the data provider will call query statements for you .

What query are you working with?

Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Harry Zhu  Tuesday, October 06, 2009 6:34 AM
Thank you very much. I've since been able to produce similar queries by using something along the lines of

SqlCommand dataCommand = new SqlCommand();
dataCommand.Connection = dataConnection;
dataCommand.CommandText = "my generic sql commands"

I also messed around with the stored procedures and got a few to work.

I'm trying to use the Object Relational Designer, but after adding my data connection to the Database Explorer, I lack the ability to drag it onto the "design surface"

I'll click and drag... but it does not do anything.  Do you have any idea why that might be the case?  Thanks for your help.

zbix  Wednesday, October 07, 2009 9:42 PM

You can use google to search for other answers

Custom Search

More Threads

• Change ColorTable of a custom ToolStripProfessionalRenderer class?
• databinding
• c# class with 2 controls
• image backgound borders
• Adding lines from a flat file
• To refer to another form
• Couldn't get Design Time license for 'SoftwareFX.ChartFX.Lite error
• Simple Question about tools in Visual C# '08
• creating an executable file in Visual C# express
• GuidanceAutomationToolkit.msi