[MySQL] Invalid string or buffer length

Pagina: 1
Acties:

  • ArjanC
  • Registratie: Juli 2001
  • Laatst online: 26-01 17:16
Ik probeer via een asp script data in een Mysql Databeest te stoppen.
de versie van mysql is 4.0.3


maar als ik boven de 10 inserts kom dan geeft hij een error:


Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Invalid string or buffer length

/newuser/request_new_user_done.asp, line 122


line 122 is een recordset.update

stukje code :

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
set strConn = server.CreateObject("ADODB.Connection")
strConn.ConnectionTimeout=60
strConn.Open ("DSN=newuser")
set recordset = server.CreateObject("ADODB.recordset")
strSQL = "Select * From TblNewUser"

recordset.open strSQL,strconn,1,2
Recordset.addnew
    
Recordset("sessieID") = SessieID

If trim(Request.Form("SpecialInstructions")) >"" then
recordset("SpecialInstructions") = Request.Form("SpecialInstructions")
end if

Recordset("ArOther") = Otherlocation
recordset("GuiFirstname") = Request.Form("GuiFirstname")
recordset("GuiLastname") = Request.Form("GuiLastname")
recordset("GuiLocation") = Location
recordset("GuiCountrycode") = Countrycode
recordset("GuiCompany")= Request.Form("GuiCompany")
recordset("GuiJobtitle") = Request.Form("GuiJobtitle")
recordset("GuiJobFunction") = Request.Form("GuiJobFunction")
recordset("GuiPhonenumber") = Request.Form("GuiPhonenumber")
recordset("GuiFaxnumber") = Request.Form("GuiFaxnumber")
recordset("GuiCostcenter") = Request.Form("GuiCostcenter")
recordset("GuiControlEntity") = Request.Form("GuiControlEntity")
recordset("GuiManager") = Request.Form("GuiManager")            
recordset("GuiITManager") = Request.Form("GuiITManager")
    
recordset.update
recordset.close
set recordset = nothing


alvast bedankt :) _/-\o_

Verwijderd

Komen al je datatypes wel overeen?

  • ArjanC
  • Registratie: Juli 2001
  • Laatst online: 26-01 17:16
ja,

dit was eerst een Access DB, die heb ik laten omzeten naar MySQL

  • robjanssen
  • Registratie: September 2001
  • Laatst online: 02-08 16:10

robjanssen

Software Developer

Gebruik anders eens een INSERT query.

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
strSQL = "INSERT INTO TblNewUser (ArOther, GuiFirstname, GuiLastname, GuiLocation, GuiCountrycode, GuiCompany, GuiJobtitle, GuiJobFunction, GuiPhonenumber, GuiFaxnumber, GuiCostcenter, GuiControlEntity, GuiManager, GuiITManager) " _
            & "VALUES ('" & Otherlocation & "', " _
            & "'" & Request.Form("GuiFirstname") & "', " _
            & "'" & Request.Form("GuiLastname") & "', " _
            & "'" & Location & "', " _
            & "'" & Countrycode & "', " _
            & "'" & Request.Form("GuiCompany") & "', " _
            & "'" & Request.Form("GuiJobtitle") & "', " _
            & "'" & Request.Form("GuiJobFunction") & "', " _
            & "'" & Request.Form("GuiPhonenumber") & "', " _
            & "'" & Request.Form("GuiFaxnumber") & "', " _
            & "'" & Request.Form("GuiCostcenter") & "', " _
            & "'" & Request.Form("GuiControlEntity") & "', " _
            & "'" & Request.Form("GuiManager") & "', " _    
            & "'" & Request.Form("GuiITManager") & "')"
strConn.Execute strSQL

  • pjonk
  • Registratie: November 2000
  • Laatst online: 29-12-2025
Tjah lijkt mij dat ergens een veld leeg is of invalid data bevat.
Je kan de methode van robjanssen gebruiken en print voor de strConn.Execute strSQL even de strSQL. Dat is wat makkelijker debuggen.

It’s nice to be important but it’s more important to be nice


  • 23m3
  • Registratie: Augustus 2001
  • Laatst online: 13:57

23m3

Time to change batteries!

Misschien zijn er velden die niet leeg (NOT NULL) mogen zijn, waar je toevallig een lege string in probeert te proppen...

  • ArjanC
  • Registratie: Juli 2001
  • Laatst online: 26-01 17:16
thanks voor de replys morgen gelijk effkes probeeren :)

  • ArjanC
  • Registratie: Juli 2001
  • Laatst online: 26-01 17:16
Hee, de insert into werkt !

dit is dus de enige manier om iets in een MySQL DB te stoppen ?
hoe kan je zoiets doen in een insert string?

code:
1
2
3
4
5
If trim(Request.Form("OtherJobFunction")) >"" then
recordset("GuiJobFunction") = Request.Form("OtherJobFunction")
else
recordset("GuiJobFunction") = Request.Form("GuiJobfunction")
end if


of moet je eerst van alle waardes een variable maken?

[ Voor 18% gewijzigd door ArjanC op 03-12-2002 08:43 ]

Pagina: 1