0

Hi every boddy

Big problem here. I don't know if from access or vb.net

I program in Visual Basic inside Visual Studio 2010
I have Access 2002 dbase with the first field caled ID_no : autonumber and primarykey and it is a "LONG INTEGER" I can not change because it is the only choice...
I Have a Public NoLignePass As Integer with : 99 not '99' or "99" During debug I put my mouse over and right integer 99

My select VB code is :
Dim mySelectQuery As String = "SELECT ID_no, nom_navire, no_navire FROM DB_FACTURE WHERE (ID_no = (SELECT MIN(IDD) AS Expr1 FROM DB_FACTURE DB_FACTURE_1 WHERE (ID_no > '" + NoLignePass + "') AND (nom_navire = '" + Nom_du_navire + "')))"

The query not pass with problem : Conversion from string "SELECT ID_no, nom_navire, no_nav" to type 'Double' is not valid.

Insted I add .tostring :
Dim mySelectQuery As String = "SELECT ID_no, nom_navire, no_navire FROM DB_FACTURE WHERE (ID_no = (SELECT MIN(IDD) AS Expr1 FROM DB_FACTURE DB_FACTURE_1 WHERE (ID_no > '" + NoLignePass.toString + "') AND (nom_navire = '" + Nom_du_navire + "')))"

And the output is :
SELECT ID_no, nom_navire, no_navire FROM DB_FACTURE WHERE (ID_no = (SELECT MIN(IDD) AS Expr1 FROM DB_FACTURE DB_FACTURE_1 WHERE (ID_no > '99') AND (nom_navire = 'Aletheia')))
And I have : Data type mismatch in criteria expression

If I try the output in my QueryTestWindows and remove the quote '99' to 99 The request worqing perfectly

My question is, how I can get my true number on my line ( 99 ) with no quote ?

Thanks for your answer

Edited by Reverend Jim: corrected typo in title (changed "valib" to "valid")

2
Contributors
2
Replies
14
Views
3 Years
Discussion Span
Last Post by DanielTradeWs
0

Check your WHERE clause, it should be

WHERE (ID_no > " + NoLignePass.toString + ") 

and not

WHERE (ID_no > '" + NoLignePass.toString + "') 

remove single qoute

Edited by ryanjayson

0

Wow!!!! So logical and evident... :-/ that effectivly work...

This post is now close

Thanks ryanjayson

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.