Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Trouble with datasets when updating stored procedures with output parms.

Posted on 2012-03-24
2
Medium Priority
?
362 Views
Last Modified: 2012-03-25
I created the attached stored procedure for self learning and it has 4 output parms.

@NewOrderLine int OUTPUT ,
      @ReturnCode int OUTPUT,
      @ReturnMessage varchar(255) OUTPUT,
      @RowsChanged int OUTPUT

When I add a dataset to the WinForms project and choose option to build strongly typed data set over the stored procedure I get the warning shown in the attached word document.

My questions is can I write the SP to avoid this problem and still have output parms?
Or how can I write the C# code to use the generated dataset?  (I want to use the strongly typed set, I do not want to use a weakly defined dataset.)
 
My code is as follows.
NW_orderDetailsDataSetTableAdapters.OrderDetailSelectByOrderTableAdapter ta = new OrderDetailSelectByOrderTableAdapter();

NW_orderDetailsDataSet.OrderDetailSelectByOrderDataTable dsOrders = new NW_orderDetailsDataSet.OrderDetailSelectByOrderDataTable();

            ta.Fill(dsOrders, 10250);
            foreach (var dsOrder in dsOrders)
            {
                Debug.WriteLine(dsOrder.Quantity.ToString());
                dsOrder.Quantity += 1;
            }
            try
            {
                //this code throws the exeception that the output parms are not defined.
                int update = ta.Update(dsOrders);
                Debug.WriteLine(update.ToString());
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.ToString());
                Debug.WriteLine(e1.ToString());
                throw;
            }
NorthWindOrderDetailUpateScript.sql
steps-to-add-stronly-typed-datas.docx
0
Comment
Question by:wilfordrocks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
DBAduck - Ben Miller earned 2000 total points
ID: 37761985
Because they are output parameters, you can assign them values of NULL

@NewOrderline int = NULL OUTPUT

But the warning is just telling you that the values in the DataSet will not be used in the calls.

Set default values for the OUTPUT parameters and see how it goes for you.
0
 

Author Closing Comment

by:wilfordrocks
ID: 37762674
Thank you.  I forget that OTUPUT to Sequel means in and out.  Unlike Oracle and Sybase.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question