| Problem with updating Access Database using ADO.NET
|
free_style

msg:4106058 | 5:07 pm on Mar 28, 2010 (gmt 0) | Hello guys, I am new in ASP, ADO and IIS, but I find a good tutorial in w3schools. I've started reading the ADO tutorial, because I want to create a simple web page, which is connected to a database. I will use Access database (.mdb). So, I've created two web pages. First one is for importing the data in fields, this data should be imported in the Access database. Second one is for importing the data from the fields to the database. Here the code for the first page:
<html> <body>
<form method="post" action="input.asp"> <table> <tr> <td>Номер на протокола:</td> <td><input name="protocolid"></td> </tr><tr> <td>Номер на клиента:</td> <td><input name="clientid"></td> </tr><tr> <td>Име на клиента:</td> <td><input name="clientname"></td> </tr><tr> <td>Дата на посещение:</td> <td><input name="date"></td> </tr><tr> <td>Проблем:</td> <td><input name="problem"></td> </tr><tr> <td>Решение:</td> <td><input name="solution"></td> </tr><tr> <td>Коментар:</td> <td><input name="comment"></td> </tr><tr> <td>Служител отишъл на мястото:</td> <td><input name="employee"></td> </tr><tr> <td>Слежител на фирмата приел протокола:</td> <td><input name="contactperson"></td> </tr> </table> <br /><br /> <input type="submit" value="Добави протокола"> <input type="reset" value="Изчисти"> </form>
</body> </html> Here is the code for the second page:
<html> <body>
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "D:\Inetpub\wwwroot\Protocols.mdb"
sql="INSERT INTO Protocols(ClientID,ClientName," sql=sql & "Date,Problem,Solution,Comment,Employee,ContactPerson)" sql=sql & " VALUES " sql=sql & "('" & Request.Form("clientID") & "'," sql=sql & "'" & Request.Form("clientName") & "'," sql=sql & "'" & Request.Form("date") & "'," sql=sql & "'" & Request.Form("problem") & "'," sql=sql & "'" & Request.Form("solution") & "'," sql=sql & "'" & Request.Form("comment") & "'," sql=sql & "'" & Request.Form("employee") & "'," sql=sql & "'" & Request.Form("contactperson") & "')"
on error resume next conn.Execute sql,recaffected if err<>0 then Response.Write("No update permissions!") else Response.Write("<h3>" & recaffected & " record added</h3>") end if conn.close %>
</body> </html> So, my problem is that I get this error: "No update permissions!" I've saw that this error happen really often, but there is not any solutions of it. I've tried a lot of thing to solve the problem, like set permissions to database for IUSR_machine and EVERYONE; copy the database in the other place and so on. Can you please help me with this problem? Thank you!
|
Ocean10000

msg:4106066 | 5:53 pm on Mar 28, 2010 (gmt 0) | Welcomed to WebmasterWorld. A couple of guess's on whats causing the problems. (1) Maybe the file is readonly, thus not updateable. (2) Maybe the values being inserted are larger then the set field sizes. (3) Maybe a single quote value is sliping in causing errors.
|
free_style

msg:4106068 | 5:59 pm on Mar 28, 2010 (gmt 0) | Hi Ocean10000, First, thank you for your answer! Second, here is answer of this topics that you guess (1) The file is not read only. (2) The values is the right as they should be. I've also tried with null values. (3) I've copied this code from w3schools, so I think it should be right.
|
Ocean10000

msg:4106138 | 10:06 pm on Mar 28, 2010 (gmt 0) | try this to get a more discriptive error so we can proceed. If Err.Number <> 0 Then Response.Write(Err.Description) Else Response.Write("<h3>" & recaffected & " record added</h3>") End If
|
bmcgee

msg:4106718 | 4:18 am on Mar 30, 2010 (gmt 0) | Is your date field really a "text" field? If not, then you shouldn't wrap it in ticks but rather in hashes.
|
free_style

msg:4107781 | 7:27 pm on Mar 31, 2010 (gmt 0) | Hello guys, First I want to thank you for the asnwers. Finaly, I solve the problem. First I comment this part: If Err.Number <> 0 Then Response.Write(Err.Description) Else Response.Write("<h3>" & recaffected & " record added</h3>") End If and saw that the problem is was exactly with the date field. Thank you!
|
|
|