unbound SQL stored procedures

lewinski

Member
Joined
May 28, 2007
Messages
5
Programming Experience
Beginner
Hello

I am just trying to get to grips with VS 2005 having come over from another platform, which shall remain nameless, and I am having lots of difficulty getting my head around VS data handling.

Drag dropping with grids and form controls etc from the Data Sources is fine, but when I try and follow the MSDN examples on executing stored procedures I get lost in errors.

I have an SQL Server with a stored procedure. All I want to do, for examples sake, is work in unbound mode - connect to the server when needed, execute the stored proc, count(col), assign the result to a variable then disconnect and carry on working unbound.

Im sorry for the very basic nature of this but I wouldnt have asked if I hadnt genuinely exhausted myself with my own futile attempts. I think getting set in the right direction should help me orientate myself.

Thanking you in advance.
 
Open a new dataset
Right click the surface
Add.. Query
QueriesTableAdapter Appears
Choose Create New Stored Procedure
Enter the sproc text, i dont know what you want, but it might be something like:
VB.NET:
CREATE PROCEDURE dbo.ScalarQuery
AS
	SET NOCOUNT ON;
SELECT     COUNT(*) AS CTR
FROM         Customer
Make a new instance of QueriesTableAdapter in your form, then call:

Dim i as Integer = qeriesTA.ScalarQuery()

Job done

Read the DW2 link in my sig, section on stored procedures, scalar values
 
Dear cjard

Thank you for your response.

That simple example has given me a much clearer understanding of adapters.

I intend to use the .net cf with SQL Mobile, which does not support stored procs. Do you have a view on the most efficient and/or secure alternative for this task?

Thanks again.

Lewinski
 
Back
Top