Running Queries...

  • Thread starter Thread starter Darryn
  • Start date Start date
D

Darryn

Hi

I am running a access query through my code that has some Nz functions in
it. But when i execute the query i get the following error

undefined function "Nz" in expression.

Yet the query runs fine when i run it in access?

how do i avoid this?

Thanks

Darryn
 
I am running a access query through my code that has some Nz functions in

How do you run the query?
Through ADO interop, or ADO.NET?
Which driver are you using?

Greetings,
Wessel
 
Here is my code...

//Get the Bank Totals...

CBBankRecTotals = new OleDbCommand("qryCBBankTotals", CBConnect) ;

CBBankRecTotals.CommandType = CommandType.StoredProcedure ;

OleDbParameter CBParamDate = CBBankRecTotals.Parameters.Add("@pDate",
OleDbType.DBDate) ;

CBParamDate.Value = period.ToShortDateString() ;

OleDbParameter CBParamCode = CBBankRecTotals.Parameters.Add("@pBankCode",
OleDbType.VarChar, 9) ;

CBParamCode.Value = txtFBC.txtCode.Text ;
 
CBBankRecTotals = new OleDbCommand("qryCBBankTotals", CBConnect) ;

That looks like code to call a stored procedure, which is called
"qryCBBankTotals". That's a strange name for a stored procedure, because
the "qry" prefix suggests a view, not a stored procedure.

At any rate, native Access (MDF format) does not support stored
procedures, so I assume you are using the ADP format to connect to a SQL
server. SQL Server doesn't support NZ(), which is an Access native
function. Try to use IsNull() instead.

Greetings,
Wessel
 
Back
Top