0

I have this problem,
I have a SQL code working perfectly on SQL Query windows...

SELECT ID_no, nom_navire, date_mes, date_sav, description, nom_fourn, no_facture, date_facture, accept, decline FROM            DB_FACTURE WHERE( ID_no = 39)

Answer perfect
On my code Is ...

SELECT devise FROM FOURNISSEURS WHERE nom_fourn = '" + Nom_FournPass + "'

Nom_FournPass = 39 not '39' or "39" everithing look ok but receive this (Conversion from string "" to type 'Double' is not valid)

Here my compleate code

Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\R├ęclamation 2013-11.mdb"
        Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)

        Dim DeviseFournisseur As String
        Dim Nom_FournPass As String = Nom_Fourn.SelectedItem

        Try

            Dim myReader As OleDb.OleDbDataReader
            Dim mySelectQuery As String = "SELECT devise FROM FOURNISSEURS WHERE nom_fourn = '" + Nom_FournPass + "'"
            Dim myConnection As New OleDb.OleDbConnection(connectionString)
            Dim myCommand As New OleDb.OleDbCommand(mySelectQuery, myConnection)
            myConnection.Open()
            myReader = myCommand.ExecuteReader()
            myReader.Read()

            DeviseFournisseur = myReader.GetString(0)

            myReader.Close()
            myConnection.Close()

            If DeviseFournisseur = "us" Then USD_INV.CheckState = CheckState.Checked
            If Not DeviseFournisseur = "us" Then USD_INV.CheckState = CheckState.Unchecked

            If DeviseFournisseur = "eu" Then EU_INV.CheckState = CheckState.Checked
            If Not DeviseFournisseur = "eu" Then EU_INV.CheckState = CheckState.Unchecked

        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

The error occur when the tread pass the SQL request

Does someone can help me!!!

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

You declare the varible as
dim no as double=Val(Textbox1.text)

Edited by Reverend Jim: typo

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.