help about dataset

I

indra

Hi,

do you know why i got error on this:



da = new SqlDataAdapter();

ds = new DataSet();

da.SelectCommand.CommandText=" SELECT EmployeeID, LastName, FirstName FROM
Employees ";

da.SelectCommand.Connection = cnn;

da.Fill(ds);



Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 390: da = new SqlDataAdapter();
Line 391: ds = new DataSet();
Line 392: da.SelectCommand.CommandText="SELECT EmployeeID, LastName,
FirstName FROM Employees";Line 393: da.SelectCommand.Connection = cnn;
 
K

Ken Cox [Microsoft MVP]

Have you verified your syntax?

SqlDataAdapter da = new SqlDataAdapter();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top