Error in SqlHelper method - vs2005

  • Thread starter Thread starter Rick
  • Start date Start date
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");
 
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?
 
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");
 
Back
Top