Home > Archive > ASP .NET > January 2006 > Guestbook Problems
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Guestbook Problems
|
|
| Oded Dror 2006-01-30, 9:57 pm |
| 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
| |
| Juan T. Llibre 2006-01-31, 7:59 am |
| 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
==================================
"Oded Dror" <odeddror@cox.net> wrote in message news:egK4rYhJGHA.2320@TK2MSFTNGP11.phx.gbl...
> 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
>
>
>
|
|
|
|
|