[ASP Acces DB] Problemen met schrijven naar DataBase

Pagina: 1
Acties:
  • 36 views sinds 30-01-2008

  • MarcelFolkers
  • Registratie: Maart 2004
  • Laatst online: 20-04 11:59
De melding die ik krijg is:
Soort fout:
code:
1
2
3
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access-stuurprogramma] De bewerking moet worden uitgevoerd op een query die kan worden bijgewerkt.
/groep2/b_meestvraag.asp, line 33


Hier onder de bestanden die ik gebruik, ik weet dat het een grote lap tekst is maar goed. ik hoop dat er toch iemand is die een oplossing weet/ de fout ziet.

alvast bedankt..!

De include file:
code:
1
2
3
4
5
6
7
8
9
<%
function getConnection()
    dim con
    set con = server.createobject("ADODB.Connection")

    con.open("DRIVER=Microsoft Access Driver (*.mdb);DBQ=c:\inetpub\wwwroot\groep2\db\timmerman.mdb;")
    set getConnection = con
end function
%>


b_meest.asp
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<%option explicit%>
<!-- #include virtual="/groep2/include/connection.inc" -->
<%
dim connDb, objRS, strAktie, strID

strAktie = trim(request("Aktie"))
strID = 1
select case strAktie
  case "Toevoegen"
    response.redirect("b_meestvraag.asp?Mutatie=Toevoegen")
  case "Wijzigen"
    response.redirect("b_meestvraag.asp?Mutatie=Wijzigen&ID="&strID)  
  case "Verwijderen"
    response.redirect("b_meestvraag.asp?Mutatie=Verwijderen&ID="&strID)  
  case else
    call main()
end select

sub Vragen()

dim strVraag, strAntwoord
  set ConnDb = GetConnection()

  set objRS = connDB.execute("select Vraag, Antwoord from Meestgesteldevraag order by ID")

  Do while not objRS.EOF
  %>
  <tr>
    <td>Vraag:</td>
  </tr>
  <tr>
    <td><%=(objRs("vraag"))%></td>
  </tr>
  <tr>
    <td>Antwoord:</td>
  </tr>
  <tr>
    <td><%=(objRs("antwoord"))%></td>
  </tr>
  <%
    objRS.MoveNext 
  Loop
  objRS.close
  set objRS = nothing
  ConnDb.close
  set ConnDb = nothing
end sub

sub main()
%>
<html>
<head>
    <title>H.J.Timmerman Beheer</title>
</head>

<body>

<form name="mainform" method="post">
<table border="0" cellspacing="0" cellpadding="0">
  <%call vragen()%>
  <tr>
    <td height=10></td>
  </tr>
  <tr>
    <td><input type="submit" name="Aktie" value="Toevoegen"></td>
    <td width="20"></td>
    <td><input type="submit" name="Aktie" value="Wijzigen"></td>
    <td width="20"></td>
    <td><input type="submit" name="Aktie" value="Verwijderen"></td>
  </tr>
</table>

</body>
</form>
</html>
<%
end sub
%>


b_meestvraag.asp
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<%option explicit%>
<!-- #include virtual="/groep2/include/connection.inc" -->
<%
dim ConnDb, objRS, strID, strMutatie, strVraag, strAntwoord, strAktie

strMutatie = trim(request("Mutatie"))
strID = trim(request("ID"))
strAktie = trim(request("Aktie"))

select case strAktie
  case "Toevoegen"
    call Toevoegen()
  case "Wijzigen"
    call Wijzigen()
  case "Verwijderen"
    call Verwijderen()
  case else
    call main()
end select

function dbCheck(strInput)
  dbCheck = replace(strInput, "'", "''")
end function

sub Toevoegen()
  dim strVraag2, strAntwoord2
  
  strVraag2 = trim(request("Vraag"))
  strAntwoord2 = trim(request("Antwoord"))
  
  set ConnDb = GetConnection()

  Conndb.execute("insert into Meestgesteldevraag (vraag, antwoord) values ('"&dbcheck(strVraag2)&"', '"&dbcheck(strAntwoord2)&"')")

  ConnDb.close
  set ConnDb = nothing
end sub

sub Wijzigen()
  dim strVraag2, strAntwoord2
  
  strVraag2 = trim(request("Vraag"))
  strAntwoord2 = trim(request("Antwoord"))
  
  Conndb.execute("insert into Meestgesteldevraag (vraag, antwoord) values ('"&dbcheck(strVraag2)&"', '"&dbcheck(strAntwoord2)&"') where ID="&strID&"")

  ConnDb.close
  set ConnDb = nothing
end sub

sub Verwijderen()
  
  set ConnDb = GetConnection()

  conndb.execute("delete Meestgesteldevraag where ID="&strID&"")

  ConnDb.close
  set ConnDb = nothing
end sub

sub main()
  if strMutatie = "Toevoegen" then
  else
    set ConnDb = GetConnection()

    set objRS = conndb.execute("select vraag, antwoord from Meestgesteldevraag where ID="&strID&"")

    Do while not objRS.EOF
    strVraag = (objRs("vraag"))
    strAntwoord = (objRs("antwoord"))
    objRS.MoveNext 
    Loop
  
    objRS.close
    set objRS = nothing
    ConnDb.close
    set ConnDb = nothing
  end if

%>
<html>
<head>
    <title>H.J. Timmerman Beheer</title>
</head>

<form name="mainform" method="post">
<body>
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>Vraag:</td>
  </tr>
  <tr>
    <td><textarea cols=75 rows=3 name="Vraag"><%=strVraag%></textarea></td>
  </tr>
  <tr>
    <td>Antwoord:</td>
  </tr>
  <tr>
    <td><textarea cols=75 rows=3 name="Antwoord"><%=strAntwoord%></textarea></td>
  </tr>
  <tr>
    <td><input type="submit" name="Aktie" value=<%=strMutatie%>></td>
    <td><input type="submit" name="Aktie" value="Annuleren"></td>
  </tr>
</table>
</body>
</form>
</html>
<%end sub%>

  • P_de_B
  • Registratie: Juli 2003
  • Niet online

Oops! Google Chrome could not find www.rijks%20museum.nl


  • Jaspertje
  • Registratie: September 2001
  • Laatst online: 18-05 15:53

Jaspertje

Max & Milo.. lief

je zet te veel code neer

lama

[ Voor 99% gewijzigd door Jaspertje op 30-03-2004 16:28 ]


  • MarcelFolkers
  • Registratie: Maart 2004
  • Laatst online: 20-04 11:59
Oeehh .. stom .. :S bedankt in ieder geval..

  • .oisyn
  • Registratie: September 2000
  • Laatst online: 10:24

.oisyn

Moderator Devschuur®

Demotivational Speaker

Woei een lap code \o/
Woei een slotje \o/

Wij gaan code niet voor je debuggen, mag je helemaal zelf doen

Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.


Dit topic is gesloten.