<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OLEDB" %>
<script runat=server>
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
Dim DBConn as OleDbConnection
Dim DBAdd As New OleDbCommand
DBConn = New OleDbConnection( _
"PROVIDER=Microsoft.Jet.OLEDB.4.0;" _
& "DATA SOURCE=" _
& Server.MapPath("EmployeeDatabase.mdb;"))
DBAdd.CommandText = "Insert Into Employee (" _
& "LastName, FirstName ) values (" _
& "'" & Replace(txtLastName.Text, "'", "''") _
& "', " _
& "'" & Replace(txtFirstName.Text, "'", "''") _
& "')"
DBAdd.Connection = DBConn
DBAdd.Connection.Open
DBAdd.ExecuteNonQuery()
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Adding Access Data</TITLE>
</HEAD>
<Body LEFTMARGIN="40">
<form runat="server">
<BR>
Last Name:
<BR>
<asp:textbox
id="txtLastName"
runat="Server"
/>
<BR>
First Name:
<BR>
<asp:textbox
id="txtFirstName"
runat="Server"
/>
<BR><BR>
<asp:button
id="butOK"
text=" OK "
onclick="SubmitBtn_Click"
runat="server"
/>
</form>
</BODY>
</HTML>
|