Hello everyone, Im trying to write to a database but i keep getting an error, for some reason it doesnt like my connection string even though i have connectivity to the database: ADODB.Command (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. My code is: Set strCon = Server.CreateObject ("ADODB.Command") strCon.ActiveConnection = MM_MyDSN_STRING <Stops at this line Any help would be appreciated Thanks
yes it does, i have this <!-- #include virtual="testproject/common/adovbs.inc" --> at the top of the page
Can you post some more of your code because "strCon.ActiveConnection = MM_MyDSN_STRING" is not the problem, it's what comes before that, i.e. the values you want to write and the sql string.
I changed strCon.ActiveConnection because i thought that might have been the problem, but here is more of my code: <% <!-- #include virtual="testproject/common/adovbs.inc" --> <!--#include file="Connections/MyDSN.asp" --> Dim Problem_ID Dim Priotiy_Level Dim Problem_Site Dim Problem_Description Dim Problem_Status Dim Job_Status Dim Tempvar1, Tempvar2, Tempvar3, Tempvar4, Tempvar5, Tempvar6 Dim UserRequestRS Dim strConn Dim strSQL Dim MM_MyDSN_STRING Tempvar1 = Request.Form("ProblemID") Tempvar2 = Request.Form("PriotiyLevel") Tempvar3 = Request.Form("ProblemSite") Tempvar4 = Request.Form("ProblemDescription") Tempvar5 = Request.Form("ProblemStatus") Tempvar6 = Request.Form("JobStatus") Response.write "<p> " & Tempvar1 & " </p>" Response.write "<p> " & Tempvar2 & " </p>" Response.write "<p> " & Tempvar3 & " </p>" Response.write "<p> " & Tempvar4 & " </p>" Response.write "<p> " & Tempvar5 & " </p>" Response.write "<p> " & Tempvar6 & " </p>" Set strConn = Server.CreateObject ("ADODB.Connection") strConn.ConnectionString = MM_MyDSN_STRING set UserRequestRS = Server.Createobject("ADODB.Recordset") strSQL= "SELECT * FROM DeskTable" strConn.open UserRequestRS.Open strSQL, strConn, 3,2 UserRequestRs.AddNew UserRequestRs.Update UserRequestRs.Fields("Problem_ID").value= ProblemID UserRequestRs.Fields("Priotiy_Level").value= PriotiyLevel UserRequestRs.Fields("Problem_Site").value= ProblemSite UserRequestRs.Fields("Problem_Description").value= ProblemDescription UserRequestRs.Fields("Problem_Status").value= ProblemStatus UserRequestRs.Fields("Job_Status").value= JobStatus UserRequestRs.Update SQL= "INSERT INTO DeskTable (Problem_ID,Priotiy_Level,Problem_Area,Problem_Description,Problem_Status,Job_Status)" SQL= SQL & " VALUES " SQL= SQL & "(" & Problem_ID & "'," SQL= SQL & "'" & Priotiy_Level & "'," SQL= SQL & "'" & Problem_Site & "'," SQL= SQL & "'" & Problem_Description & "'," SQL= SQL & "'" & Problem_Status & "'," SQL= SQL & "'" & Job_Status & "')" strConn.Execute SQL Response.Write("Thank you for your request") set UserRequestRS = nothing Set strConn = Nothing %>
The first thing to check and correct is the discrepancy in naming, i.e. you have everywhere ProblemSite or Problem_Site yet in your sql statement you have : SQL= "INSERT INTO ............... Problem_Area make sure that you use the exact form name and the exact table field name.