Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored procedure and typed dataset
Message
From
06/08/2003 14:58:59
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
 
 
To
06/08/2003 14:04:42
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00817416
Message ID:
00817435
Views:
17
I think I figured it out. I needed to specify the table in the Fill, like this:
MyTestAdapter.Fill(MyTestDataSet,"CustOrderHist")
>I'm learning how to call stored procedures with VS .NET, using the CustOrderHist stored procedure in the Northwind database. Basically, I have a test form with a textbox for the CustomerID, a DataGrid to display the results, and a button to execute the stored procedure. When I fill a plain, untyped dataset, everything works as expected. However, if I try to use a typed dataset, no records show up in the DataGrid (I do see the column headings). I suspect the problem may be the way I created the typed dataset. All I did was drag the CustOrderHist stored procedure from the Server Explorer to the dataset design area. Should I have done anything differently? Here is the code I am using:
>
>string ConnectionString = "data source=JOEL-PC;initial catalog=Northwind;" +
>      "integrated security=SSPI;persist security info=True;workstation id=JOEL-PC;packet size=4096";
>SqlDataAdapter MyTestAdapter = new SqlDataAdapter("CustOrderHist",ConnectionString);
>MyTestAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
>MyTestAdapter.SelectCommand.Parameters.Add(new SqlParameter("@CustomerID",SqlDbType.NChar, 5));
>MyTestAdapter.SelectCommand.Parameters["@CustomerID"].Value = this.txtCustID.Text;
>
>// *** this works ***
>DataSet MyTestDataSet = new DataSet();
>
>// *** this doesn't work ***
>//SPDataset1 MyTestDataSet = new SPDataset1();
>
>MyTestAdapter.Fill(MyTestDataSet);
>this.dataGrid1.DataSource = MyTestDataSet.Tables[0];
>
>
>Thanks.
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Previous
Reply
Map
View

Click here to load this message in the networking platform