Error in SqlHelper method - vs2005

R

Rick

Line #2 in the following code generates an error; what am I doing wrong?

Error 1 The best overloaded method match for
'Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(string,
System.Data.CommandType, string)' has some invalid arguments

Code:

Line #1 System.Data.DataSet dsCust = new System.Data.DataSet();
Line #2 dsCust = SqlHelper.ExecuteReader(sqlConnection,
CommandType.Text, "SELECT * FROM Customer");
 
S

Stanimir Stoyanov

Hi Rick,

It is strange that in the error message the method is ExecuteDataset while
your second line of code reads ExecuteReader but the method sugnatures are
the same.

Can you check which one of the two is true?
 
J

Jeff Johnson

Line #2 in the following code generates an error; what am I doing wrong?

Error 1 The best overloaded method match for
'Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(string,
System.Data.CommandType, string)' has some invalid arguments

Code:

Line #1 System.Data.DataSet dsCust = new System.Data.DataSet();
Line #2 dsCust = SqlHelper.ExecuteReader(sqlConnection,
CommandType.Text, "SELECT * FROM Customer");

I'll mention something unrelated: since you're going to be getting a DataSet
back from the ExecuteDataset() method, there is absolutely no reason to use
new in the declaration. In fact, you ought to just have one line:

System.Data.DataSet dsCust = SqlHelper.ExecuteReader(sqlConnection,
CommandType.Text, "SELECT * FROM Customer");
 

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

Top