سلام عليكم ورحمه الله اوبركاتة
اخواني معاي كود asp.net
وهو مختص بالتعامل مع قاعده البيانات من نوع اكسس 2007
عمل الكود اضافه وحذف في قاعده البيانات اكسس 2007
هذا الكود لكن فيه اخطاء ارجو التعديل
<%@ page language=VB Debug=true %>
02 <%@ Import namespace="system.Data" %>
03 <%@ Import namespace="system.Data.oleDB" %>
04 <script runat=server>
05 sub submitbtn_click(sender as object, e as EVentargs)
06 Dim DBconn as oledbconnection
07 Dim DBadd as new oledbcommand
08 DBconn = new oleDbconnection("provider=Microsoft.ace.oleDB.12.0;Data source=C:\inetpub\wwwroot\12.accdb;")
09 dbconn.open()
10 DBadd.commandtext = "delete * from customers where Last_name = '" & txtLastname.text _
11 DBadd.commandtext = "insert Into customers (" _
12 & "Last_name, First_name ) values (" _
13 & " ' " & Replace(txtlastname.Text, " ' " , " ' ' ") _
14 & " ', " _
15 & " ' " & Replace(txtFirstname.text, " ' " , " ' ' " ) _
16 & " ' ) "
17 DBAdd.connection = DBconn
18 DBAdd.Executenonquery()
19 DBadd.connection.close
20 end sub
21 </script>
22 <html>
23 <head>
24 <TITLE>Adding Access Data</TITLE>
25 </HEAD>
26 <BODY LEFTMARGIN="40">
27 <Form runat="server">
28 <BR>
29 Last Name:
30 <BR>
31 <asp:textbox
32 Id="txtLastname"
33 runat="server"
34 />
35 <BR>
36 <BR><BR>
37 <asp:button
38 id="butok"
39 text=" ok "
40 onclick="submitbtn_click"
41 runat="server"
42 />
43 <BR>
44 Last Name:
45 <BR>
46 <asp:textbox
47 Id="txtLastname"
48 runat="server"
49 />
50 <BR>
51 First name:
52 <BR>
53 <asp:textbox
54 id="txtFirstname"
55 runat="server"
56
57 />
58 <BR><BR>
59 <asp:button
60 id="butok"
61 text=" ok "
62 onclick="submitBtn_click"
63 runat="server"
64 />
65 </form>
66 </BODY>
67 </html>