I want to fetch multiple data from oracle database and want to store it into another variables in C# .net.
Kindly help me on this and suggest me a code.As for now I am using this code:-
Here is my Code.
string conn = "provider=MSDAORA;data source=mdmdb_tb;user id=testapp;password=testapp";
using (OleDbConnection myOleDbConnection = new OleDbConnection(conn))
{
myOleDbConnection.Open();
using (OleDbCommand cmd = new OleDbCommand("SELECT DISTINCT AC.ACCOUNTID as accid ,MT.SERIALNUMBER as srno,AC.NAME as names,OC.OPCONAME as town1,OC.CITY discm FROM ACCOUNT AC, XXMETERHIST M, LSMDPHYSICALMETER MT,LSSERVICEPOINT P,LSMDMTRMANUFACTURER MANUFAC,OPERATINGCOMPANY OC,LSMARKET LS WHERE AC.UIDACCOUNT = M.UIDACCOUNT AND M.UIDPHYSICALMETER = MT.UIDPHYSICALMETER and LS.MARKETID = OC.OPCOCODE and LS.UIDMARKET = P.UIDMARKET and MANUFAC.UIDMTRMANUFACTURER = MT.UIDMETERMANUFACTURER AND M.UIDSERVICEPOINT = P.UIDSERVICEPOINT and MT.SERIALNUMBER ='?' AND MT.UIDPHYSMTRTYPE = '43' ORDER BY 1", myOleDbConnection))
{
OleDbParameter p1 = new OleDbParameter();
p1.ParameterName = "@MeterSerialNumber";
p1.OleDbType = OleDbType.VarChar;
p1.Direction = ParameterDirection.Input;
p1.Value = MeterSerialNumber;
cmd.Parameters.Add(p1);
using (OleDbDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
string accid = (string)reader["accid"];
string srno = (string)reader["srno"];
string names = (string)reader["names"];
string town1 = (string)reader["town1"];
string discm = (string)reader["discm"];
}
}
}
}