Hi ,
If you are using Wizard to create a DataSet and Tables Adapter use the following code to fill the corresponding tables.
Code:
DataSet1 ds1 = new DataSet1();
AnyTableAdapter ata = new AnyTableAdapter();
ata.Fill(ds1.anyTable);
In any other case if u try to fill programmatic ally use the following methods fill by procedure and fill by Query.
Return DataTable fill by Query method
Code:
public DataTable RunSelectQuery(string sqlQuery, OracleParameter[] @params)
{
OracleDataAdapter objDataAdapter = default(OracleDataAdapter); ;
DataTable dt = new DataTable();
try
{
OpenConnection();
OracleCommand cmd = new OracleCommand(sqlQuery, dbConnection);
cmd.CommandType = CommandType.Text;
objDataAdapter = new OracleDataAdapter(cmd);
ResolveParameters(ref cmd, @params);
objDataAdapter.Fill(dt);
}
catch (Exception oErr)
{
throw oErr;
}
finally
{
CloseConnection();
if ((objDataAdapter != null)) objDataAdapter.Dispose();
}
return dt;
}
Return DataSet fill By procedure
Code:
public DataSet FillDataSetWithProcedure(string spName, OracleParameter[] @params)
{
DataSet returnDs = new DataSet();
OracleDataAdapter da = new OracleDataAdapter();
OracleCommand cmd = new OracleCommand();
try
{
OpenConnection();
cmd = new OracleCommand(spName, dbConnection);
cmd.CommandType = CommandType.StoredProcedure;
ResolveProcParameters(ref cmd, @params);
da = new OracleDataAdapter(cmd);
da.Fill(returnDs);
}
catch (Exception ex)
{
throw ex;
}
finally
{
CloseConnection();
if ((da != null)) da.Dispose();
if ((cmd != null)) cmd.Dispose();
}
return returnDs;
}
The return data Source assigned to specified DataGridView to fill the record.
The above code return in C# supported by Oracle Data Access . if you need any further help let me know about it.