J
Joerg M. Colberg
Hi all,
I have a problem when using a DataSet. I am using it to query a
SQLServer database as follows. In my code it looks like
SqlDataAdapter eDA = new SqlDataAdapter(sqlcmd);
// where sqlcmd is a SQL String
DataSet ds = new DataSet();
eDA.fill(ds);
So far so good. That runs without any problems and I can get
the data out of the DataSet ds without any problems. But later in the
same code, I want to re-use ds. Thing is I get so much data back from
the database that if I write
eDA = new SqlDataAdapter(sqlcmd2);
// where sqlcmd2 is a different SQL String
DataSet ds2 = new DataSet();
eDA.fill(ds2);
the code just stops. It doesn't give me any error messages and if
I put a try-catch block around "eDA.fill(ds2);" there's nothing to
be caught. So I wanted to use something like
ds.Clear();
to empty ds and then re-fill it with different data:
eDA = new SqlDataAdapter(sqlcmd2);
eDA.Fill(ds);
but that won't work. I put some console output around the last line
and that line just never comes back (I ran it over the weekend...).
What is the problem? How would I empty the DataSet and then re-fill
it so that it won't just die?
- Joerg Colberg
I have a problem when using a DataSet. I am using it to query a
SQLServer database as follows. In my code it looks like
SqlDataAdapter eDA = new SqlDataAdapter(sqlcmd);
// where sqlcmd is a SQL String
DataSet ds = new DataSet();
eDA.fill(ds);
So far so good. That runs without any problems and I can get
the data out of the DataSet ds without any problems. But later in the
same code, I want to re-use ds. Thing is I get so much data back from
the database that if I write
eDA = new SqlDataAdapter(sqlcmd2);
// where sqlcmd2 is a different SQL String
DataSet ds2 = new DataSet();
eDA.fill(ds2);
the code just stops. It doesn't give me any error messages and if
I put a try-catch block around "eDA.fill(ds2);" there's nothing to
be caught. So I wanted to use something like
ds.Clear();
to empty ds and then re-fill it with different data:
eDA = new SqlDataAdapter(sqlcmd2);
eDA.Fill(ds);
but that won't work. I put some console output around the last line
and that line just never comes back (I ran it over the weekend...).
What is the problem? How would I empty the DataSet and then re-fill
it so that it won't just die?
- Joerg Colberg