6 Replies - 467 Views - Last Post: 20 March 2013 - 04:41 AM Rate Topic: -----

#1 mattijsstu  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 18-February 13

problem sql insert

Posted 20 March 2013 - 12:58 AM

Hi i have a problem with my program. I made a sql update wich works fine. Now i have added an insert wich is done when the user does not check a checkbox, if he does check the checkbox the update sql is run.

my code is the following:

    Private Sub todatabtn_Click(sender As Object, e As EventArgs) Handles todatabtn.Click

        If offertenummer2tbx.Text <> "" And overschrijvenchbx.Checked Then
            Dim dt As New DataTable()
            dt = sqlSELECT("SELECT * FROM database_dimensionering WHERE offertenummer = '" + offertenummer2tbx.Text + "'")
            If dt.Rows.Count > 0 Then
                sqlUPDATE("UPDATE database_dimensionering SET" & _
                          "[Capaciteit Q in m/s]='" + debiettbx.Text & _
                          "', [opstellingshoek  in ]='" + Opstellingshoektbx.Text & _
                          "', [Aantal gangen a]='" + aantalgangentbx.Text & _
                          "', [Tastpunt T in m]='" + tastpunttbx.Text & _
                          "', [Stortpunt S in m]='" + stortpuntTBX.Text & _
                          "', [Werk]='" + Werk.Text & _
                          "', [Vijzeldiameter D in m]='" + GekozenvijzeldiameterTBX.Text & _
                          "', [Balkdiameter d in m]='" + gekozenBalkdiameterTXB.Text & _
                          "', [Hydraulisch rendement van de vijzel ηH in %]='" + Rendvijztbx.Text & _
                          "', [Rendement elastische koppeling ηEK in %]='" + RendElastbx.Text & _
                          "', [Rendement reductiekast ηRK in %]='" + RendREUCtbx.Text & _
                          "', [Rendement riemtransmissie ηRT in %]='" + rendRIEMtbx.Text & _
                          "', [Rendement motor ηM in %]='" + rendMOTORtbx.Text & _
                          "', [Toerental van de vijzel n in tr/min]='" + toerentalvijzel.ToString & _
                          "', [Lengte van de beschoeping L in m]='" + lengtebeschoeping.ToString & _
                          "', [Doorbuiging in mm]='" + doorbuiging.ToString & _
                          "', [Spoed Sp]='" + gekozenvijzeldiameter.ToString & _
                          "', [Balkdikte b in mm]='" + balkdikte.ToString & _
                          "', [Bladdikte s in mm]='" + dikteschoepcombx.Text & _
                          "', [Vijzelgewicht G in kg]='" + totaalgewicht.ToString & _
                          "', [Vulpunt V in m]='" + Vulpunt.ToString & _
                          "', [Tegenmaalpunt T1 in m]='" + tegenmaalpunt.ToString & _
                          "', [Theoretische statische opvoerhoogte HT in m]='" + statischeopvoerhoogte.ToString & _
                          "', [Vulhoogte hV in m]='" + Vulhoogte.ToString & _
                          "', [Tegenwaterpeilhoogte ht in m]='" + Tegenwaterpeilhoogte.ToString & _
                          "', [Lekspleet S1 in mm]='" + lekspleet.ToString & _
                          "', [Groepsrendement ηT in %]='" + nT.ToString & _
                          "', [Opgenomen vermogen aan de vijzelas PVA in kW]='" + PVA.ToString & _
                          "', [Opgenomen vermogen aan de motoras PMA in kW]='" + PMA.ToString & _
                          "', [Opgenomen vermogen aan de motorklemmen PMK in kW]='" + PMK.ToString & _
                          "', [Geinstaleerd mororvermogen PM in kW]='" + PM.ToString & _
                          "', [Specifiek energieverbruik E in kWh/m]='" + Es.ToString & _
                          "', [Gewicht watervulling GW in kg]='" + massawater.ToString & _
                          "', [Vertikale reaktie onderlager F1 in N]='" + f1.ToString & _
                          "', [Horizontale reaktie onderlager F2 in N]='" + f2.ToString & _
                          "', [vertikale reaktie bovenlager F3 in N]='" + f3.ToString & _
                          "', [Horizontale reaktie bovenlager F4 in N]='" + f4.ToString & _
                          "', [Koppel aan de vijzelas C in Nm]='" + koppelC.ToString & _
                          "', [Koppel aan de motoras CM in Nm]='" + koppelCM.ToString & _
                          "', [Spanning in de vijzelbalk SPN in N/cm]='" + SPN.ToString & _
                          "', [Asdiameter bovenlager dBL in mm]='" + dBL.ToString & _
                          "', [Asdiameter onderlager dOL in mm]='" + dOL.ToString & _
                          "' WHERE offertenummer='" + offertenummer2tbx.Text + "'")

                ' Me.Database_dimensioneringTableAdapter.Insert(Werk.Text, offertenummer.Text, resultfromtextbox1, resultfromtextbox7, gekozenvijzeldiameter, gekozenbalkdiameter, aantalgangen, toerentalvijzel, lengtebeschoeping, doorbuiging, gekozenvijzeldiameter, balkdikte, dikteschoepen, totaalgewicht, resultfromtextbox6, Vulpunt, resultstortpunt, tegenmaalpunt, statischeopvoerhoogte, Vulhoogte, Tegenwaterpeilhoogte, lekspleet, nH, nEK, nRK, nRT, nM, nT, PVA, PMA, PMK, PM, Es, massawater, f1, f2, f3, f4, koppelC, koppelCM, SPN, dBL, dOL)
            End If
        Else
            Dim dt As New DataTable()

            sqlinsert("INSERT INTO database_dimensionering('[Capaciteit Q in m/s]" & _
                      "', [opstellingshoek  in ]'" & _
                      "', [Aantal gangen a]'" & _
                      "', [Tastpunt T in m]'" & _
                      "', [Stortpunt S in m]'" & _
                      "', [Werk]'" & _
                      "', [Vijzeldiameter D in m]'" & _
                      "', [Balkdiameter d in m]'" & _
                      "', [Hydraulisch rendement van de vijzel ηH in %]'" & _
                      "', [Rendement elastische koppeling ηEK in %]'" & _
                      "', [Rendement reductiekast ηRK in %]'" & _
                      "', [Rendement riemtransmissie ηRT in %]'" & _
                      "', [Rendement motor ηM in %]'" & _
                      "', [Toerental van de vijzel n in tr/min]'" & _
                      "', [Lengte van de beschoeping L in m]'" & _
                      "', [Doorbuiging in mm]'" & _
                      "', [Spoed Sp]'" & _
                      "', [Balkdikte b in mm]'" & _
                      "', [Bladdikte s in mm]'" & _
                      "', [Vijzelgewicht G in kg]'" & _
                      "', [Vulpunt V in m]'" & _
                      "', [Tegenmaalpunt T1 in m]'" & _
                      "', [Theoretische statische opvoerhoogte HT in m]'" & _
                      "', [Vulhoogte hV in m]'" & _
                      "', [Tegenwaterpeilhoogte ht in m]'" & _
                      "', [Lekspleet S1 in mm]'" & _
                      "', [Groepsrendement ηT in %]'" & _
                      "', [Opgenomen vermogen aan de vijzelas PVA in kW]'" & _
                      "', [Opgenomen vermogen aan de motoras PMA in kW]'" & _
                      "', [Opgenomen vermogen aan de motorklemmen PMK in kW]'" & _
                      "', [Geinstaleerd mororvermogen PM in kW]'" & _
                      "', [Specifiek energieverbruik E in kWh/m]'" & _
                      "', [Gewicht watervulling GW in kg]'" & _
                      "', [Vertikale reaktie onderlager F1 in N]'" & _
                      "', [Horizontale reaktie onderlager F2 in N]'" & _
                      "', [vertikale reaktie bovenlager F3 in N]'" & _
                      "', [Horizontale reaktie bovenlager F4 in N]'" & _
                      "', [Koppel aan de vijzelas C in Nm]'" & _
                      "', [Koppel aan de motoras CM in Nm]'" & _
                      "', [Spanning in de vijzelbalk SPN in N/cm]'" & _
                      "', [Asdiameter bovenlager dBL in mm]'" & _
                      "', [Asdiameter onderlager dOL in mm]')" & _
                      "', [offertenummer]')" & _
                      " VALUES('" & debiettbx.Text & "'" & _
                      ",'" & Opstellingshoektbx.Text & "'" & _
                      ",'" & aantalgangentbx.Text & "'" & _
                      ",'" & tastpunttbx.Text & "'" & _
                      ",'" & stortpuntTBX.Text & "'" & _
                      ",'" & Werk.Text & "'" & _
                      ",'" & GekozenvijzeldiameterTBX.Text & "'" & _
                      ",'" & gekozenBalkdiameterTXB.Text & "'" & _
                      ",'" & Rendvijztbx.Text & "'" & _
                      ",'" & RendElastbx.Text & "'" & _
                      ",'" & RendREUCtbx.Text & "'" & _
                      ",'" & rendRIEMtbx.Text & "'" & _
                      ",'" & rendMOTORtbx.Text & "'" & _
                      ",'" & toerentalvijzel.ToString & "'" & _
                      ",'" & lengtebeschoeping.ToString & "'" & _
                      ",'" & doorbuiging.ToString & "'" & _
                      ",'" & gekozenvijzeldiameter.ToString & "'" & _
                      ",'" & balkdikte.ToString & "'" & _
                      ",'" & dikteschoepcombx.Text & "'" & _
                      ",'" & totaalgewicht.ToString & "'" & _
                      ",'" & Vulpunt.ToString & "'" & _
                      ",'" & tegenmaalpunt.ToString & "'" & _
                      ",'" & statischeopvoerhoogte.ToString & "'" & _
                      ",'" & Vulhoogte.ToString & "'" & _
                      ",'" & Tegenwaterpeilhoogte.ToString & "'" & _
                      ",'" & lekspleet.ToString & "'" & _
                      ",'" & nT.ToString & "'" & _
                      ",'" & PVA.ToString & "'" & _
                      ",'" & PMA.ToString & "'" & _
                      ",'" & PMK.ToString & "'" & _
                      ",'" & PM.ToString & "'" & _
                      ",'" & Es.ToString & "'" & _
                      ",'" & massawater.ToString & "'" & _
                      ",'" & f1.ToString & "'" & _
                      ",'" & f2.ToString & "'" & _
                      ",'" & f3.ToString & "'" & _
                      ",'" & f4.ToString & "'" & _
                      ",'" & koppelC.ToString & "'" & _
                      ",'" & koppelCM.ToString & "'" & _
                      ",'" & SPN.ToString & "'" & _
                      ",'" & dBL.ToString & "'" & _
                      ",'" & dOL.ToString & "'" & _
                      ",'" & offertenummer.Text & "')")




        End If
    End Sub

    Private Sub vuldatainbtn_Click(sender As Object, e As EventArgs) Handles vuldatainbtn.Click
        Dim dt As New DataTable()
        dt = sqlSELECT("SELECT * FROM database_dimensionering WHERE offertenummer = '" + offertenummer2tbx.Text + "'")
        
        If dt.Rows.Count > 0 Then
            debiettbx.Text = dt.Rows(0)("Capaciteit Q in m/s").ToString()
            Opstellingshoektbx.Text = dt.Rows(0)("opstellingshoek  in ").ToString()
            aantalgangentbx.Text = dt.Rows(0)("Aantal gangen a").ToString()
            tastpunttbx.Text = dt.Rows(0)("Tastpunt T in m").ToString()
            stortpuntTBX.Text = dt.Rows(0)("Stortpunt S in m").ToString()
            Werk.Text = dt.Rows(0)("Werk").ToString()
            GekozenvijzeldiameterTBX.Text = dt.Rows(0)("Vijzeldiameter D in m").ToString()
            gekozenBalkdiameterTXB.Text = dt.Rows(0)("Balkdiameter d in m").ToString()
            Rendvijztbx.Text = dt.Rows(0)("Hydraulisch rendement van de vijzel ηH in %").ToString()
            RendElastbx.Text = dt.Rows(0)("Rendement elastische koppeling ηEK in %").ToString()
            RendREUCtbx.Text = dt.Rows(0)("Rendement reductiekast ηRK in %").ToString()
            rendRIEMtbx.Text = dt.Rows(0)("Rendement riemtransmissie ηRT in %").ToString()
            rendMOTORtbx.Text = dt.Rows(0)("Rendement motor ηM in %").ToString()
            offertenummer.Text = dt.Rows(0)("offertenummer").ToString()
        Else
            offertenummer2tbx.Text = ""
        End If

    End Sub

    Private Function sqlSELECT(sql As String) As DataTable
        Dim dt As New DataTable()
        Dim myDataSet As DataSet = New DataSet()
        Dim connectstr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\STAGE\week(1802-2202)\database_dimensioneren.accdb"
        Dim myConnection As New OleDbConnection(connectstr)
        myConnection.Open()
        Dim myCommand As New OleDbCommand(sql, myConnection)
        Dim myDA As OleDbDataAdapter = New OleDbDataAdapter()
        myDA.SelectCommand = myCommand
        myDA.Fill(myDataSet, "database_dimensionering")
        dt = myDataSet.Tables("database_dimensionering")
        myCommand.Connection.Close()
        Return dt
    End Function

    Private Sub sqlUPDATE(sql As String)
        Dim dt As New DataTable()
        Dim myDataSet As DataSet = New DataSet()
        Dim connectstr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\STAGE\week(1802-2202)\database_dimensioneren.accdb"
        Dim myConnection As New OleDbConnection(connectstr)
        myConnection.Open()
        Dim myCommand As New OleDbCommand(sql, myConnection)
        myCommand.ExecuteNonQuery()
        myCommand.Connection.Close()
    End Sub
    Private Sub sqlinsert(sql As String)
        Dim dt As New DataTable()
        Dim myDataSet As DataSet = New DataSet()
        Dim connectstr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\STAGE\week(1802-2202)\database_dimensioneren.accdb"
        Dim myConnection As New OleDbConnection(connectstr)
        myConnection.Open()
        Dim myCommand As New OleDbCommand(sql, myConnection)
        myCommand.ExecuteNonQuery()
        myCommand.Connection.Close()
    End Sub

End Class



my code without the new sql insert wich causes problems is :

  Private Sub todatabtn_Click(sender As Object, e As EventArgs) Handles todatabtn.Click

        If offertenummer2tbx.Text <> "" And overschrijvenchbx.Checked Then
            Dim dt As New DataTable()
            dt = sqlSELECT("SELECT * FROM database_dimensionering WHERE offertenummer = '" + offertenummer2tbx.Text + "'")
            If dt.Rows.Count > 0 Then
                sqlUPDATE("UPDATE database_dimensionering SET" & _
                          "[Capaciteit Q in m/s]='" + debiettbx.Text & _
                          "', [opstellingshoek  in ]='" + Opstellingshoektbx.Text & _
                          "', [Aantal gangen a]='" + aantalgangentbx.Text & _
                          "', [Tastpunt T in m]='" + tastpunttbx.Text & _
                          "', [Stortpunt S in m]='" + stortpuntTBX.Text & _
                          "', [Werk]='" + Werk.Text & _
                          "', [Vijzeldiameter D in m]='" + GekozenvijzeldiameterTBX.Text & _
                          "', [Balkdiameter d in m]='" + gekozenBalkdiameterTXB.Text & _
                          "', [Hydraulisch rendement van de vijzel ηH in %]='" + Rendvijztbx.Text & _
                          "', [Rendement elastische koppeling ηEK in %]='" + RendElastbx.Text & _
                          "', [Rendement reductiekast ηRK in %]='" + RendREUCtbx.Text & _
                          "', [Rendement riemtransmissie ηRT in %]='" + rendRIEMtbx.Text & _
                          "', [Rendement motor ηM in %]='" + rendMOTORtbx.Text & _
                          "', [Toerental van de vijzel n in tr/min]='" + toerentalvijzel.ToString & _
                          "', [Lengte van de beschoeping L in m]='" + lengtebeschoeping.ToString & _
                          "', [Doorbuiging in mm]='" + doorbuiging.ToString & _
                          "', [Spoed Sp]='" + gekozenvijzeldiameter.ToString & _
                          "', [Balkdikte b in mm]='" + balkdikte.ToString & _
                          "', [Bladdikte s in mm]='" + dikteschoepcombx.Text & _
                          "', [Vijzelgewicht G in kg]='" + totaalgewicht.ToString & _
                          "', [Vulpunt V in m]='" + Vulpunt.ToString & _
                          "', [Tegenmaalpunt T1 in m]='" + tegenmaalpunt.ToString & _
                          "', [Theoretische statische opvoerhoogte HT in m]='" + statischeopvoerhoogte.ToString & _
                          "', [Vulhoogte hV in m]='" + Vulhoogte.ToString & _
                          "', [Tegenwaterpeilhoogte ht in m]='" + Tegenwaterpeilhoogte.ToString & _
                          "', [Lekspleet S1 in mm]='" + lekspleet.ToString & _
                          "', [Groepsrendement ηT in %]='" + nT.ToString & _
                          "', [Opgenomen vermogen aan de vijzelas PVA in kW]='" + PVA.ToString & _
                          "', [Opgenomen vermogen aan de motoras PMA in kW]='" + PMA.ToString & _
                          "', [Opgenomen vermogen aan de motorklemmen PMK in kW]='" + PMK.ToString & _
                          "', [Geinstaleerd mororvermogen PM in kW]='" + PM.ToString & _
                          "', [Specifiek energieverbruik E in kWh/m]='" + Es.ToString & _
                          "', [Gewicht watervulling GW in kg]='" + massawater.ToString & _
                          "', [Vertikale reaktie onderlager F1 in N]='" + f1.ToString & _
                          "', [Horizontale reaktie onderlager F2 in N]='" + f2.ToString & _
                          "', [vertikale reaktie bovenlager F3 in N]='" + f3.ToString & _
                          "', [Horizontale reaktie bovenlager F4 in N]='" + f4.ToString & _
                          "', [Koppel aan de vijzelas C in Nm]='" + koppelC.ToString & _
                          "', [Koppel aan de motoras CM in Nm]='" + koppelCM.ToString & _
                          "', [Spanning in de vijzelbalk SPN in N/cm]='" + SPN.ToString & _
                          "', [Asdiameter bovenlager dBL in mm]='" + dBL.ToString & _
                          "', [Asdiameter onderlager dOL in mm]='" + dOL.ToString & _
                          "' WHERE offertenummer='" + offertenummer2tbx.Text + "'")

                ' Me.Database_dimensioneringTableAdapter.Insert(Werk.Text, offertenummer.Text, resultfromtextbox1, resultfromtextbox7, gekozenvijzeldiameter, gekozenbalkdiameter, aantalgangen, toerentalvijzel, lengtebeschoeping, doorbuiging, gekozenvijzeldiameter, balkdikte, dikteschoepen, totaalgewicht, resultfromtextbox6, Vulpunt, resultstortpunt, tegenmaalpunt, statischeopvoerhoogte, Vulhoogte, Tegenwaterpeilhoogte, lekspleet, nH, nEK, nRK, nRT, nM, nT, PVA, PMA, PMK, PM, Es, massawater, f1, f2, f3, f4, koppelC, koppelCM, SPN, dBL, dOL)
            End If
        Else
          'sql insert goes here, look at code above to see what i use
        End If
    End Sub

    Private Sub vuldatainbtn_Click(sender As Object, e As EventArgs) Handles vuldatainbtn.Click
        Dim dt As New DataTable()
        dt = sqlSELECT("SELECT * FROM database_dimensionering WHERE offertenummer = '" + offertenummer2tbx.Text + "'")
        
        If dt.Rows.Count > 0 Then
            debiettbx.Text = dt.Rows(0)("Capaciteit Q in m/s").ToString()
            Opstellingshoektbx.Text = dt.Rows(0)("opstellingshoek  in ").ToString()
            aantalgangentbx.Text = dt.Rows(0)("Aantal gangen a").ToString()
            tastpunttbx.Text = dt.Rows(0)("Tastpunt T in m").ToString()
            stortpuntTBX.Text = dt.Rows(0)("Stortpunt S in m").ToString()
            Werk.Text = dt.Rows(0)("Werk").ToString()
            GekozenvijzeldiameterTBX.Text = dt.Rows(0)("Vijzeldiameter D in m").ToString()
            gekozenBalkdiameterTXB.Text = dt.Rows(0)("Balkdiameter d in m").ToString()
            Rendvijztbx.Text = dt.Rows(0)("Hydraulisch rendement van de vijzel ηH in %").ToString()
            RendElastbx.Text = dt.Rows(0)("Rendement elastische koppeling ηEK in %").ToString()
            RendREUCtbx.Text = dt.Rows(0)("Rendement reductiekast ηRK in %").ToString()
            rendRIEMtbx.Text = dt.Rows(0)("Rendement riemtransmissie ηRT in %").ToString()
            rendMOTORtbx.Text = dt.Rows(0)("Rendement motor ηM in %").ToString()
            offertenummer.Text = dt.Rows(0)("offertenummer").ToString()
        Else
            offertenummer2tbx.Text = ""
        End If

    End Sub

    Private Function sqlSELECT(sql As String) As DataTable
        Dim dt As New DataTable()
        Dim myDataSet As DataSet = New DataSet()
        Dim connectstr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\STAGE\week(1802-2202)\database_dimensioneren.accdb"
        Dim myConnection As New OleDbConnection(connectstr)
        myConnection.Open()
        Dim myCommand As New OleDbCommand(sql, myConnection)
        Dim myDA As OleDbDataAdapter = New OleDbDataAdapter()
        myDA.SelectCommand = myCommand
        myDA.Fill(myDataSet, "database_dimensionering")
        dt = myDataSet.Tables("database_dimensionering")
        myCommand.Connection.Close()
        Return dt
    End Function

    Private Sub sqlUPDATE(sql As String)
        Dim dt As New DataTable()
        Dim myDataSet As DataSet = New DataSet()
        Dim connectstr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\STAGE\week(1802-2202)\database_dimensioneren.accdb"
        Dim myConnection As New OleDbConnection(connectstr)
        myConnection.Open()
        Dim myCommand As New OleDbCommand(sql, myConnection)
        myCommand.ExecuteNonQuery()
        myCommand.Connection.Close()
    End Sub



I hope some one can help me becaus i have not found an anwser yet.

Thank you in advance

Is This A Good Question/Topic? 0
  • +

Replies To: problem sql insert

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: problem sql insert

Posted 20 March 2013 - 03:35 AM

So what error do you receive when the problem occurs?

right off the bat this doesn't look right
sqlinsert("INSERT INTO database_dimensionering('[Capaciteit Q in m³/s]" & _

What are you trying to do with that apostrophe that i marked red? That would cause a problem.

This post has been edited by CharlieMay: 20 March 2013 - 03:37 AM

Was This Post Helpful? 0
  • +
  • -

#3 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: problem sql insert

Posted 20 March 2013 - 03:43 AM

actually mattijsstu, you have a bunch of apostrophes throughout the fields side of your insert statement that are causing you an issue.

This would be a good example of a reason to use paramaterized statements.
Was This Post Helpful? 0
  • +
  • -

#4 mattijsstu  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 18-February 13

Re: problem sql insert

Posted 20 March 2013 - 03:49 AM

Oh thats right that should not be there :).

I still get the error tho..

this is the error:Posted Image

if i use the cath at that error spot it says:

Posted Image

thank you for helping me out
Was This Post Helpful? 0
  • +
  • -

#5 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: problem sql insert

Posted 20 March 2013 - 03:50 AM

in case you missed it, read post #3
Was This Post Helpful? 0
  • +
  • -

#6 mattijsstu  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 18-February 13

Re: problem sql insert

Posted 20 March 2013 - 04:34 AM

so it should be like this :

"," & dBL.ToString & "" & _

(not working by the way)

or do i need to delete certain "?
Was This Post Helpful? 0
  • +
  • -

#7 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: problem sql insert

Posted 20 March 2013 - 04:41 AM

No. On the FIELDS side of your insert you are putting apostrophes. They should not be there.
sqlinsert("INSERT INTO database_dimensionering('[Capaciteit Q in m³/s]" & _
                    "', [opstellingshoek ß in °]'" & _
                    "', [Aantal gangen a]'" & _
                    "', [Tastpunt T in m]'" & _
                    "', [Stortpunt S in m]'" & _
                    "', [Werk]'" & _
                    "', [Vijzeldiameter D in m]'" & _
                    "', [Balkdiameter d in m]'" & _
                    "', [Hydraulisch rendement van de vijzel ηH in %]'" & _

None of those apostrophes should be there. This is just a small section of it of course.

INSERT INTO myTable (Field1, Field2) VALUES ('value1', 'value2')

You have
INSERT INTO myTable ('Field1', 'Field2') VALUES ('value1', 'value2')

This post has been edited by CharlieMay: 20 March 2013 - 04:42 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1