greenmeanie
New Member
I need to insert data into an existing page, the page works, however when i look at the database to see if the new information is there, is is not. So my questions is, how do i commit from the ASP code.<BR><BR>Here is my code<BR><%<BR> Xindex=session("indexN")<BR> userid=session("urID")<BR> term= "Spring 03"<BR><BR>Dim objcommand, adCmdText<BR>adCmdText = 1<BR><BR>set objcommand = server.createObject("ADODB.Command")<BR>objCommand.ActiveConnection = "Provider=MSDAORA.1;User ID=******;Password=******;Data Source=Neelix;Persist Security Info=True"<BR>objCommand.Commandtext = "insert into enrollments(SID, indexnum, term) values('" & userid & "','"& Xindex &"','" & term &"')"<BR>objCommand.CommandType=adCmdText<BR>objcommand.execute <BR><BR>set objCommand = Nothing<BR> response.write ("<BR><font size='5'>Registration Completed</font><BR>") & chr(13)<BR> response.write "SID: <font size='4'> " & userid & "</font><BR>"<BR>response.write "Index Number: <font size='4'>" & Xindex & "</font><BR>"<BR>response.write "Term: <font size='4'> " & term & "</font><BR>" <BR>%><BR>thanks in advanceTry <BR>objCommand.ExecuteNonQuery()<BR><BR>that should do it
<BR>didn't work, i got an saying that <BR>Error Type:<BR>Microsoft VBScript runtime (0x800A01B6)<BR>Object doesn't support this property or method: 'ExecuteNonQuery'<BR><BR>anythings else i should try??Here my code for doing it pulled of one or our pages<BR>Dim objConn as New SQLConnection("MyConnectionString")<BR>strInsert = "INSERT INTO kb_category (kb_id, category_id) VALUES(" &strMaxValue &", " &lbxCategoryLvl2.SelectedItem.Value &")"<BR><BR>Dim objCmdKbCat as New SQLCommand(strInsert, ObjConn)<BR>try<BR> objCmdKbCat.ExecuteNonQuery()<BR>catch<BR> response.write ("<b>Error Running this command:</b> " &strInsert)<BR>end tryWoops you need to open the connection too.<BR>objCmdKbCat.Connection.Open()
