Jump to content

Insert Insert Select - .net Experts


Recommended Posts

Posted
.Net &sql
 
From .net am passing var1, var2 to the sql SP which has couple f inser statements and one SELECT statement 
I f Use execute nonquery i can get the records get inserted properly.. but how to get the SELECT stmt results back to the .net scrren???????????
 
 
CREATE SP mySp
@var1,
var2
 
Insert stament..
Intesrt stement
 
select * from sometable
 
 
Ee sp lo last lo select stmnt ni .Net lo ela read cheyali..
 
 
Pls help....
  • Upvote 1
Posted

what it this bootu puranam man... Insert Insert.....

Posted

what it this bootu puranam man... Insert Insert.....

pakkana .Net ani pettina kada sitti... :5_2_108:

Posted

ExecuteNonQuery select ki work avvadhu bhayya. Use ExecuteReader instead. 

Posted

ExecuteNonQuery select ki work avvadhu bhayya. Use ExecuteReader instead. 

Appudu insert stmts pancichesthaya?

Posted

 

ExecuteNonQuery() use chey...oka outparameter pass chey.....

 

.NET code 

this.AddParameter(new OracleParameter("o_OUTPUTPARAMETER", OracleDbType.Int64, ParameterDirection.Output));

Command.ExecuteNonQuery();

if (Command.Parameters["o_OUTPUTPARAMETER"].Value != null)
    string something = Command.Parameters["o_OUTPUTPARAMETER"].Value.ToString();
 
 
store proc
INSERT INTO table(column1, column2)
VALUES (value1,value2)
RETURNING returnvalue INTO o_OUTPUTPARAMETER;
COMMIT;

 

 

Multipe output result set kavali bhayya TS ki. ExecuteNonQuery will only return the count of number of rows effected anthe so ExecuteReader needs to be used. 

Posted
I think this is helpful.
 
using (IDataReader reader = command.ExecuteReader())
                {
                    // get all column names
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        columns.Add(reader.GetName(i));
                    }
 
                    while (reader.Read())
                    {
                        T obj = GetItem<T>(reader, columns);
 
                        list.Add(obj);
                    }
                }
×
×
  • Create New...