'80004005' Column count doesn't match value count at row 1
Jeg har en formular, som smider data i 8 recordsets:If Request.Form("mode") = "insert_todays_weight" Then
Dim dato, vUser, ideal_weight, todays_weight, RSYesterdaysWeight, YesterdaysWeight, DiffFromYesterdayInKG, DiffFromYesterdayInPercent, losegain
dato = Day(Date) & "/" & Month(Date) & "/" & Year(Date) & " " & Time()
vUser = SQLEncode(Session("username"))
ideal_weight = Trim(Request.Form("ideal_weight"))
todays_weight = Trim(Request.Form("todays_weight"))
losegain = Request.Form("losegain")
Set RSYesterdaysWeight = Conn.Execute("SELECT * FROM ideal_weight WHERE todays_weight > 0 AND username = '" & SQLEncode(Session("username")) & "' ORDER BY ideal_weightID DESC LIMIT 1")
If Not RSYesterdaysWeight.EOF Then
YesterdaysWeight = FormatNumber(RSYesterdaysWeight("todays_weight",1))
DiffFromYesterdayInKG = FormatNumber((todays_weight - YesterdaysWeight),1)
DiffFromYesterdayInPercent = (YesterdaysWeight - DiffFromYesterdayInKG / RSYesterdaysWeight) * 100
Else
YesterdaysWeight = 0
DiffFromYesterdayInKG = 0
DiffFromYesterdayInPercent = 0
End If
Conn.Execute("INSERT INTO ideal_weight (dato, username, ideal_weight, todays_weight, YesterdaysWeight, DiffFromYesterdayInKG, DiffFromYesterdayInPercent, losegain) VALUES (" & _
"'" & dato & "', " & _
"'" & vUser & "', " & _
"" & ideal_weight & ", " & _
"" & YesterdaysWeight & ", " & _
"" & DiffFromYesterdayInKG & ", " & _
"" & DiffFromYesterdayInPercent & ", " & _
"" & todays_weight & ", " & _
"" & losegain & ")")
Conn.Close
I MySQL har jeg flg:
ideal_weightID (fortløbende, primary)
dato
username
ideal_weight
todays_weight
RSYesterdaysWeight
DiffFromYesterdayInKG
DiffFromYesterdayInPercent
losegain
Jeg prøvede at udskrive variablerne inden INSERT INTO, og her er der rigtigt nok 8 værdier til 8 kolonner
Jeg har tjekket og dobbelttjekket for tal og strengvariabler, både i databasen og i scriptet, samt kommaer i scripts. Og alligevel får jeg dette:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[MySQL][ODBC 5.3(w) Driver][mysqld-5.7.38-41-log]Column count doesn't match value count at row 1
/membersarea/profile/myweight/todaysweight/default.asp, line 51
Linie 51 = Conn.Execute("INSERT INTO ideal_weight (dato, username, ideal_weight, todays_weight, YesterdaysWeight, DiffFromYesterdayInKG, DiffFromYesterdayInPercent, losegain) VALUES (" & _
Hvor hopper kæden af?