Never mind. After walking away from it, I was able to get it to run. I'm not 100% certain what I did differently, but I assume it was just a careless error.
I have a form that allows users to enter a variety of selection criteria for viewing the data, some of which can be left blank. I am using a parameter array for the query to fill the data set. Right now I have only 3 choices, 2 of which are required. When I run the code with only the 2 required options filled in, I get an error trying to store values to the parameter array. I set a breakpoint. The array is built and it does have the correct dimensions. I have used code like this before and can't see any significant difference in this code. Maybe someone else can see where I went wrong.
The error I get is "There is no source code available for the current location." That occurs when I try to store the parameter to the first element of the parameter array : AParams[0] = this.CreateParameter("@StoreNo", storeNo).
All help is greatly appreciated.
public DataSet GetInvoiceByInvoiceNo(string storeNo, string invoiceNo, bool errorsOnly, string reqNo)
{
StringBuilder SelectionCriteria = new StringBuilder();
string ParamName;
int ParamCount = 2;
SelectionCriteria.Append("SELECT * FROM Invoice WHERE StoreNo = @StoreNo AND InvoiceNo = @InvoiceNo");
if (errorsOnly.Equals(true))
SelectionCriteria.Append(" AND not empty(errstatus)");
if (!mmType.IsEmpty(reqNo))
{
ParamCount = 3;
SelectionCriteria.Append(" AND reqno = @ReqNo");
}
IDbDataParameter[] AParams = new IDbDataParameter[ParamCount];
AParams[0] = this.CreateParameter("@StoreNo", storeNo);
AParams[1] = this.CreateParameter("@InvoiceNo", invoiceNo);
if (ParamCount > 2)
{
AParams[2] = this.CreateParameter("@ReqNo", reqNo);
}
this.FillDataSet(this.GetCurrentDataSet(), SelectionCriteria.ToString(), AParams);
return this.GetCurrentDataSet();
}
Linda Harmes
HiBit Technologies, Inc.