473,320 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to dataset values pass to procedure in asp.net

ramanan ram
i am using .net(c#) with oracle. now,the Dataset contains five rows.using for loop that dataset value to pass the procedure argument and insert into specific table.if i am execute cannot inserted into the table .but without for loop single row inserted successfully.how to pass dataset more values to procedure argument.
here that coding:

Expand|Select|Wrap|Line Numbers
  1. for(i=0; i < objDataset.Rows.Count; i++)
  2.                 {
  3.  if (objDataset.Tables[0].Rows[i].IsNull(0))
  4.                     {
  5.                         objDataset.Tables[0].Rows[i].Delete();
  6.  
  7.                     }
  8.                 }  objDataset.Tables[0].AcceptChanges();
  9.                 DataTable dt = new DataTable();
  10.                 dt = objDataset.Tables[0];
  11.                 if (dt.Rows.Count > 0)
  12.                 {
  13.                     for (i = 0; i < dt.Rows.Count; i++)
  14.                     {
  15.                         //  dbs.AddInParameter(dbcommand, "PQUOTEID", DbType.String,  dt.Rows[i]["Division"].ToString().Trim());
  16.                         dbcomm.Parameters.Add("pvdivision", OleDbType.VarChar, 200).Value = dt.Rows[i]["Division"].ToString().Trim();
  17.                         dbcomm.Parameters.Add("pvcountry", OleDbType.VarChar, 200).Value = dt.Rows[i]["Country"].ToString().Trim();
  18.                         dbcomm.Parameters.Add("pvlanded", OleDbType.VarChar, 200).Value = dt.Rows[i]["Landed"].ToString().Trim();
  19.                         dbcomm.Parameters.Add("pvtype", OleDbType.VarChar, 200).Value = dt.Rows[i]["Type"].ToString().Trim();
  20.                         dbcomm.Parameters.Add("pvcust", OleDbType.VarChar, 200).Value = dt.Rows[i]["Cust"].ToString().Trim();
  21.  
  22.                     }
  23.                 }
  24.  
  25.                 dbcomm.ExecuteNonQuery();
please help..
May 14 '12 #1

✓ answered by Rabbit

You need to execute within your loop. And don't forget to clear your parameters each time.

4 2819
Rabbit
12,516 Expert Mod 8TB
You need to execute within your loop. And don't forget to clear your parameters each time.
May 14 '12 #2
dbcomm.parametrs.clear(); within in for loop

add this line.
May 15 '12 #3
if dataadapter object is da

then to add parameters

da.selectcommand.parameters.add();
May 31 '12 #4
Expand|Select|Wrap|Line Numbers
  1.  dbcomm.Parameters.Add("pvdivision", OleDbType.VarChar, 200).Value = dt.Rows[i]["Division"].ToString().Trim();
  2.                         dbcomm.Parameters.Add("pvcountry", OleDbType.VarChar, 200).Value = dt.Rows[i]["Country"].ToString().Trim();
  3.                         dbcomm.Parameters.Add("pvlanded", OleDbType.VarChar, 200).Value = dt.Rows[i]["Landed"].ToString().Trim();
  4.                         dbcomm.Parameters.Add("pvtype", OleDbType.VarChar, 200).Value = dt.Rows[i]["Type"].ToString().Trim();
  5.                         dbcomm.Parameters.Add("pvcust", OleDbType.VarChar, 200).Value = dt.Rows[i]["Cust"].ToString().Trim();
May 31 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike P | last post by:
Is it possible to return a dataset from a stored procedure, or would you need to write the SQL in your .cs file to return the dataset? Any assistance would be really appreciated. Cheers, ...
1
by: PawelR | last post by:
Hello everybody, I have one littel question: How fill DataSet values witch return stored procedure? My SP have parameters. Thanks PawelR
1
by: TJS | last post by:
Is there a way to do this ??
9
by: Nikolay Petrov | last post by:
How to fill DataSet from stored procedure?
0
by: abc my vclass | last post by:
How to generate a dataset from stored procedure which have many resultsets? I try Dataset designer from VS2005, it only generate first table from stored procedure on server explorer. Another...
1
by: Patricio | last post by:
Hello all I have a form that contains several textbox. I have also a DataSet that contains the Fill function by ID. How can I assign the DataSet values into my TextBox? Thanks a lot.
3
by: vickilynnpgc | last post by:
I have a tsql stored procedure I want to drag from server explorer onto an xsd file. I get the error ' xml schema could not be interpreted'. The stored procedure does a select from a udf, that's...
4
by: SteveT | last post by:
I am wanting to populate several treeviews, one for the <TRs> group and one for the <TGsgroup. Is there a simplier way to populate the Treeview than the one I did below? It seems difficult to...
3
by: Jon B | last post by:
Hi There! I'm looking into Strongly Typed DataSets in the .NET Framework. I know it can generated strongly typed tables as objects and column names as properties. However, one thing that I...
6
by: jobs | last post by:
How do you return dataset from a vb.net function? my sp: ALTER FUNCTION . ( ) RETURNS TABLE AS
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.