Jeg får følgende fejlmedddelse ADODB.Recordset error \'800a0e78\' The operation requested by the application is not allowed if the object is closed.
Jeg prøver at lave en sql update hvor der hentes data ind fra tabellen samt fra en form som brugerne har indtast.... Det kunne sikkert laves bedre og mere smart men jeg er ikke en haj til asp endenu......måske en dag
Her er koden: Sub Procedure_RetKeyGeneral()
Do Until objRS Is Nothing
Do While Not objRS.EOF
For i =1 to 17 strQ = \"UPDATE TKeyGeneral\" strQ = strQ & \" SET \"& objRS(i).Name &\" =\'\" & Request.Form(\"Key\"&(i)&\"\") & \"\'\" strQ = strQ & \" WHERE Afdeling =\'\" & Request.Form(\"afNavn\") & \"\'\" objConn.Execute strQ Next objRS.MoveNext Loop Set objRS = objRS.NextRecordset Loop objConn.Close Set objConn = Nothing End Sub
Set objRS = Server.CreateObject(\"ADODB.Recordset\") Set objRS.ActiveConnection = objConn objRS.LockType = adLockPessimistic
Sub Procedure_RetKeyGeneral()
Do Until objRS Is Nothing
Do While Not objRS.EOF
For i =1 to 17 strQ = \"UPDATE TKeyGeneral\" strQ = strQ & \" SET \"& objRS(i).Name &\" =\'\" & Request.Form(\"Key\"&(i)&\"\") & \"\'\" strQ = strQ & \" WHERE Afdeling =\'\" & Request.Form(\"afNavn\") & \"\'\" objConn.Execute strQ Next objRS.MoveNext Loop Set objRS = objRS.NextRecordset Loop objConn.Close Set objConn = Nothing End Sub
Sub Procedure_TilfoejKeyGeneral()
Do Until objRS Is Nothing Do While Not objRS.EOF
Response.Write\"Tilfoej er nu aktiv\"
strQ = \"INSERT INTO TKeyGeneral\" For i = 1 to 17 Select Case i Case \"1\" strQ = StrQ =\"(\'\" & objRs(i).Name &\"\'\" Case \"17\" strQ = StrQ =\",\'\" & objRs(i).Name & \"\') VALUES\" Case else strQ = StrQ =\",\'\" & objRs(i).Name & \"\'\" End Select Next objRS.MoveNext Loop Set objRS = objRS.NextRecordset Loop
For j = 1 to 17 Select Case i Case \"1\" strQ = StrQ =\"(\'\" & Request.Form(\"Key\"&(j)&\"\") &\"\'\" Case \"17\" strQ = StrQ =\",\'\" & Request.Form(\"Key\"&(j)&\"\") & \"\')\" Case else strQ = StrQ =\",\'\" & Request.Form(\"Key\"&(j)&\"\") & \"\'\" End Select NEXT objConn.Execute strQ objConn.Close Set objConn = Nothing End Sub
Sub Procedure_SletKeyGeneral() Response.Write\"Du har nu slettet \" & Request.Form(\"afNavn\") & \" afdelingen fra landkortet\" strQ = \"DELETE FROM TKeyGeneral\" strQ = strQ & \" WHERE Afdeling =\'\" & Request.Form(\"afNavn\") & \"\'\" objConn.Execute strQ End Sub
varSql=Request.form(\"Rette\") Select Case varSql Case \"Ret\" Procedure_RetKeyGeneral() Case \"Tilføj\" Procedure_TilfoejKeyGeneral() Case \"Slet\" Procedure_SletKeyGeneral() Case else Response.Write\"Er ikke kommet ind \" End Select %>
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.