Guestbook Problems

O

Oded Dror

Please take a look at this code

<%@ Page Language="VB" Debug="true"%>
<%@ Import Namespace="System.Windows.Forms" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace ="System.Web.UI.Page" %>

<html >
<head runat="server">
<title>Guestbook</title>
<script runat="server">
Sub Submit_Click(sender As Object, e As EventArgs)
Call MyInsertMethod()
End Sub
Function MyInsertMethod() As Integer
Dim MyConn As AccessDataSource
MyConn = AccessDataSource1
Dim cmd As AccessDataSource
Dim MySQL As String = "INSERT INTO Guest (FirstName, LastName) VALUES ('" &
FirstName.Text & "','" & LastName.Text & "')"
MyConn.Open() ************ Error 1 'MyConn' is not a member of
'System.Web.UI.WebControls.AccessDataSource'.
cmd.ExecuteNonQuery(MyConn, MySQL) ******** is not a member of
'System.Web.UI.WebControls.AccessDataSource'
MyConn.Close() *************is not a member of
'System.Web.UI.WebControls.AccessDataSource'
Response.Redirect("Guestlog.aspx")
End Function
</script>

Whats wrong with this lines?
I'm trying to insert FirstName LastName into Access table

Thanks
Oded Dror
 
J

Juan T. Llibre

Questions :

1. why are you importing Windows.Forms for use in a web page ?
2. why are you importing System.Drawing ?
3. why are you importing System.Web.UI.Page ?



Juan T. Llibre
ASP.NET MVP
ASPNETFAQ.COM : http://www.aspnetfaq.com
==================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top