473,662 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with sproc to code row returning...

Hi,

I have a stored procedure on SQL Server 2005 which runs a select on 5
columns. I want to return these rows to the .NET 3.5 C# program.

I have 2 questions:

1. In the sproc - do I need an OUTPUT parameter and if yes, what type
should this be? Or do I just run the select with no OUTPUT parameter?

2. On the application layer I am using the following to capture the
output:

SqlParameter paramOut = new SqlParameter("@ ohlc", SqlDbType.VarCh ar,
-1);
paramOut.Direct ion = ParameterDirect ion.Output;
sqlComm.Paramet ers.Add(paramOu t);
Problem is though I'm unsure of the type for the SqlDbType parameter?
I would appreciate any help any can offer me here with this?
Any comments/suggestions/help would be greatly appreciated.

Al.
Aug 20 '08 #1
2 1209
al*****@altavis ta.com wrote:
I have a stored procedure on SQL Server 2005 which runs a select on 5
columns. I want to return these rows to the .NET 3.5 C# program.

I have 2 questions:

1. In the sproc - do I need an OUTPUT parameter and if yes, what type
should this be? Or do I just run the select with no OUTPUT parameter?

2. On the application layer I am using the following to capture the
output:

SqlParameter paramOut = new SqlParameter("@ ohlc", SqlDbType.VarCh ar,
-1);
paramOut.Direct ion = ParameterDirect ion.Output;
sqlComm.Paramet ers.Add(paramOu t);

Problem is though I'm unsure of the type for the SqlDbType parameter?
I would appreciate any help any can offer me here with this?
Any comments/suggestions/help would be greatly appreciated.
If you need to return 5 values, then you should return a result set.

Arne
Aug 20 '08 #2
SqlCommand cmd = new SqlCommand();
cmd.CommandText ="SomProc";
cmd.Parameters. Add("@someParam ",SqlType.Varch ar,30) .Direction =
System.Data.Par ameterDirection .Output;

that should help you

DaveL

"Arne Vajhøj" <ar**@vajhoej.d kwrote in message
news:48******** *************** @news.sunsite.d k...
al*****@altavis ta.com wrote:
>I have a stored procedure on SQL Server 2005 which runs a select on 5
columns. I want to return these rows to the .NET 3.5 C# program.

I have 2 questions:

1. In the sproc - do I need an OUTPUT parameter and if yes, what type
should this be? Or do I just run the select with no OUTPUT parameter?

2. On the application layer I am using the following to capture the
output:

SqlParameter paramOut = new SqlParameter("@ ohlc", SqlDbType.VarCh ar,
-1);
paramOut.Direc tion = ParameterDirect ion.Output;
sqlComm.Parame ters.Add(paramO ut);

Problem is though I'm unsure of the type for the SqlDbType parameter?
I would appreciate any help any can offer me here with this?
Any comments/suggestions/help would be greatly appreciated.

If you need to return 5 values, then you should return a result set.

Arne

Oct 30 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2967
by: scott | last post by:
In LISTING 2, I have a SPROC that returns a recordset and a recordcount in SQL QA. I can access the Recordset with no problem. How can I grab the Recordcount with ASP code at the same time I'm getting the Recordset? In QA, the RecordCount displays below the Recordset. The below USAGE code will display my SPROC results. USAGE: EXEC SELECT_WITH_PAGING 'CustomerID, ShipName', 'OrderID', 'Northwind.dbo.Orders', 3, 10, 1, '', 'OrderDate'...
4
1640
by: TJS | last post by:
trying to get a record count from a stored procedure using a supplied SQL statement Error msg: =========== "The SqlParameterCollection only accepts non-null SqlParameter type objects,not String objects." SPROC: ========
2
3463
by: Jeff Thur | last post by:
I am trying to Execute a simple Stored Procedure using ASP/VB. I have spent numerous hours with this, researching books and looking on the internet. I can't get a direct answer. THis is my program, followed by the errors, Can anyone Please Help, Please, Please, Please. Sub cmdGO_Click(sender As Object, e As EventArgs) DataGrid1.DataSource = GetResults(TxtSort.Text) DataGrid1.DataBind()
6
4984
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
0
1003
by: Elmo Watson | last post by:
Let's say I have a tableAdapter which uses an Insert sProc -- the last line in the sProc is a Select statement, returning the identity in code, I write something like: Dim myTA as (TableAdapter) label1.text=MyTA.Insert_sproc However, the label always gets 0, though the row is getting inserted - - anyone know how I can fix this?
0
1171
by: seevion | last post by:
My first post (beginner).. I hope it is clear enough and appreciate your taking the time to consider helping. I have an existing sproc that takes a cart transaction from a table and inserts shared values of that transaction into another table called Transaction_PT. The sproc works fine, it takes the total sale value and attributes profit share of that value to participating members. Now I need to modify this sproc to also look up the...
0
1164
by: boyindie86 | last post by:
Hi Forum, I am having some really iritating problems with an simple input page which should pass parameters into a stored procedure from the text boxes first and last name. I keep getting the error during exection of sp_myinsert, pfirstname not defined, every time i try to submit the form Has anyone got any suggestions I have giving my code for procedure and page many thanks boy
1
1415
by: boyindie86 | last post by:
Hi Forum, I am having some really iritating problems with an simple input page which should pass parameters into a stored procedure from the text boxes first and last name. I keep getting the error during exection of sp_myinsert, pfirstname not defined, every time i try to submit the form Has anyone got any suggestions I have giving my code for procedure and page many thanks boy
3
1278
by: boyindie86 | last post by:
How can i pull images out of an mysql table and populate the below datagrid. I have all my images stored in an external store, and the addresses are stored in my DB, i am not sure how to pull these addresses out and get it to populate the table. I have the followin ASP code <code><asp:DataGrid runat=server ID=test AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" Height="343px" Width="551px">...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.