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

Check your WHERE clause, it should be

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

and not

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

remove single qoute

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

This post is now close

Thanks ryanjayson

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.