cannot implicitly convert type 'int' to 'system.data.dataset'
Hi all, please I need your help, I am trying to execute a query and put
all the retrieved data in a data set, but I get this error "cannot
implicitly convert type 'int' to 'system.data.dataset'"
Here's the code:
// this is a small piece of the sql
String Astra_conn =
ConfigurationManager.ConnectionStrings["AstraSeverConnection"].ConnectionString;
System.Text.StringBuilder sql = new System.Text.StringBuilder();
sql.Append(" SELECT ROWNUM AS ID, institution, LPAD (a.zone_name, 3, '0')
AS campus, ");
sql.Append(" term_name AS term, student_instance_id AS student_id,
subject, course, ");
sql.Append(" section_name AS section_num, offering AS title, ");
//Its OracleConnection because it is an Oracle server otherwise, it would
be SqlConnection.
DataSet rs = new DataSet();
OracleConnection Astra_db_Conn = new OracleConnection(Astra_conn);
string myquery = sql.ToString();
OracleCommand cmd = new OracleCommand(myquery);
Astra_db_Conn.Open();
try
{
SqlDataAdapter adpt = new SqlDataAdapter();
rs = cmd.ExecuteNonQuery(); // this is where is get the error.
adpt.Fill(rs);
}
catch(Exception e)
{
log.Error("*** ERROR ***
IRISExportQueries.loadStudentInfoLearningSites():" + e);
}
I've also tried
Astra_db_Conn.Open();
try
{
SqlDataReader reader = new SqlDataAdapter();
reader = cmd.ExecuteNonQuery(); // this is where is get the error.
}
catch(Exception e)
{
log.Error("*** ERROR ***
IRISExportQueries.loadStudentInfoLearningSites():" +
e);</pre>
}
Then I get the error: "cannot implicitly convert type 'int' to
'System.Data.SqlClient.SqlDataReader'"
Thanks your help will be very much appreciated.
No comments:
Post a Comment