helo everybody.i got an error when i want to update records in my table! i cant find the error! i need a help! the browser this error: "Microsoft OLE DB Provider for SQL Server (0x80040E57) String or binary data would be truncated. /dolla&cam_project/councelor/patients/modifypatient.asp, line 76" the line i put in bold in the codes below. here the codes: <% 'DECLARING VARIABLES dim patient_id dim vct_id dim patient_age dim sexe dim type_visit dim partener_id dim indentity_id dim status dim education dim occupation dim vct_knowing dim age_firstraport dim nbrpartener_lasttwoM dim sexargent_lastthreeM dim sexstimulant_lasttroisM dim plxrsPsex_now dim usecondom_lastsex dim test_before dim nbrdefois dim result_know dim result_lasttest dim p_province dim p_district dim p_sector 'CAPTURING THE VALUES IN THE FORM patient_id=Request.Form("patient_id") vct_id=Request.Form("vct_id") patient_age=Request.Form("patient_age") sexe=Request.Form("sexe") type_visit=Request.Form("type_visit") partener_id=Request.Form("partener_id") indentity_id=Request.Form("indentity_id") status=Request.Form("status") education=Request.Form("education") occupation=Request.Form("occupation") vct_knowing=Request.Form("vct_knowing") age_firstraport=Request.Form("age_firstraport") nbrpartener_lasttwoM=Request.Form("nbrpartener_lasttwoM") sexargent_lastthreeM=Request.Form("sexargent_lastthreeM") sexstimulant_lasttroisM=Request.Form("sexstimulant_lasttroisM") plxrsPsex_now=Request.Form("plxrsPsex_now") usecondom_lastsex=Request.Form("usecondom_lastsex") test_before=Request.Form("test_before") nbrdefois=Request.Form("nbrdefois") result_know=Request.Form("result_know") result_lasttest=Request.Form("result_lasttest") p_province=Request.Form("p_province") p_district=Request.Form("p_district") p_sector=Request.Form("p_sector") 'connection to the my SQL DATABASE Dim connLot,connection,Recordset Set connLot = Server.CreateObject("ADODB.Connection") connLot.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = dollakay; User Id = sa; Password=loukos" 'recuperation de la variable RefLot=Request.Form("patient_id") RefLot=CINT(RefLot) 'updating the records 'create and open the record set dim Rslot dim RequesteSQL Set RsLot = Server.CreateObject("ADODB.Recordset") RsLot.open "SELECT * FROM patients WHERE patient_id='" & RefLot & "'",connLot 'command to update the records RequeteSQL = "Update patients Set vct_id=' " & vct_id & " ' , patient_age=' " & patient_age & " ', sexe=' " & sexe & " ' , type_visit=' " & type_visit & " ', partener_id=' " & partener_id & " ', indentity_id=' " & indentity_id & " ', status=' " & status & " ', education=' " & education & " ', occupation=' " & occupation & " ', vct_knowing=' " & vct_knowing & " ', age_firstraport=' " & age_firstraport & " ', nbrpartener_lasttwoM=' " & nbrpartener_lasttwoM & " ', sexargent_lastthreeM=' " & sexargent_lastthreeM & " ', sexstimulant_lasttroisM=' " & sexstimulant_lasttroisM & " ', plxrsPsex_now=' " & plxrsPsex_now & " ', usecondom_lastsex=' " & usecondom_lastsex & " ', test_before=' " & test_before & " ', nbrdefois=' " & nbrdefois & " ', result_know=' " & result_know & " ', result_lasttest=' " & result_lasttest & " ', p_province=' " & p_province & " ', p_district=' " & p_district & " ', p_sector=' " & p_sector & " ' WHERE patient_id='" & RefLot & "'" 'response.Write(RequeteSQL) 'response.End [B][SIZE="1"]connLot.Execute(RequeteSQL)[/SIZE][/B] set Rslot= Nothing connLot.close set connlot= Nothing %> <DIV align="center"> Thanks the patient records <B><%=patient_id%></B> has been updated!!! </DIV> Code (markup):
I can't see which line is bold, but did you check the size limitations on your fields to make sure you are not putting in too many characters? (i.e. occupation set to char(10) in table and you're trying to insert 'doctor of pharmicology') Also, I noticed you use RequesteSQL in the dim, but RequeteSQL in set and execute. If the line is the connLot.Execute(RequeteSQL) then the error is in the data. What query do you get if you uncomment the response.write(RequeteSQL)?