a little help here
-
im doing a samle project that i want to include in my project.. here is the sample code... <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ Import Namespace=System.Web.HttpException %> Northwind Database Login Sub doInsert(Source as Object, E as EventArgs) Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Server.MapPath("C:\Documents and Settings\Joy.PHOENIX-1D0486C\Desktop\userId.mdb") & ";" Dim MySQL as string = "Insert into Members (uid, pwd, fullname, email) " & _ "Values (@uid, @pwd, @fullname, @email)" Dim MyConn As New Data.OleDb.OleDbConnection(strConn) Dim Cmd As New Data.OleDb.OleDbCommand(MySQL, MyConn) With Cmd.Parameters .Add(New Data.OleDb.OleDbParameter("@uid", frmuid.Text)) .Add(New Data.OleDb.OleDbParameter("@pwd", frmpwd.Text)) .Add(New Data.OleDb.OleDbParameter("@fullname", frmfullname.Text)) .Add(New Data.OleDb.OleDbParameter("@email", frmemail.Text)) End With MyConn.Open() cmd.ExecuteNonQuery() MyConn.Close 'Put a label on your page to contain the 'success' response: lblMessage.Text = "Thank you for signing up. An email will be sent to you shortly." & _ "Your response will be needed from that email to activate your account" End Sub
uid
pwd
fullname
email
-
im doing a samle project that i want to include in my project.. here is the sample code... <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ Import Namespace=System.Web.HttpException %> Northwind Database Login Sub doInsert(Source as Object, E as EventArgs) Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Server.MapPath("C:\Documents and Settings\Joy.PHOENIX-1D0486C\Desktop\userId.mdb") & ";" Dim MySQL as string = "Insert into Members (uid, pwd, fullname, email) " & _ "Values (@uid, @pwd, @fullname, @email)" Dim MyConn As New Data.OleDb.OleDbConnection(strConn) Dim Cmd As New Data.OleDb.OleDbCommand(MySQL, MyConn) With Cmd.Parameters .Add(New Data.OleDb.OleDbParameter("@uid", frmuid.Text)) .Add(New Data.OleDb.OleDbParameter("@pwd", frmpwd.Text)) .Add(New Data.OleDb.OleDbParameter("@fullname", frmfullname.Text)) .Add(New Data.OleDb.OleDbParameter("@email", frmemail.Text)) End With MyConn.Open() cmd.ExecuteNonQuery() MyConn.Close 'Put a label on your page to contain the 'success' response: lblMessage.Text = "Thank you for signing up. An email will be sent to you shortly." & _ "Your response will be needed from that email to activate your account" End Sub
uid
pwd
fullname
email
You are using a physical address in the call to Server.MapPath. This is not possible, as Server.MapPath is used to turn a virtual path into a physical path, so it expects a virtual path. Just remove the call to Server.MapPath, as you already have a physical path.
--- single minded; short sighted; long gone;
-
im doing a samle project that i want to include in my project.. here is the sample code... <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ Import Namespace=System.Web.HttpException %> Northwind Database Login Sub doInsert(Source as Object, E as EventArgs) Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Server.MapPath("C:\Documents and Settings\Joy.PHOENIX-1D0486C\Desktop\userId.mdb") & ";" Dim MySQL as string = "Insert into Members (uid, pwd, fullname, email) " & _ "Values (@uid, @pwd, @fullname, @email)" Dim MyConn As New Data.OleDb.OleDbConnection(strConn) Dim Cmd As New Data.OleDb.OleDbCommand(MySQL, MyConn) With Cmd.Parameters .Add(New Data.OleDb.OleDbParameter("@uid", frmuid.Text)) .Add(New Data.OleDb.OleDbParameter("@pwd", frmpwd.Text)) .Add(New Data.OleDb.OleDbParameter("@fullname", frmfullname.Text)) .Add(New Data.OleDb.OleDbParameter("@email", frmemail.Text)) End With MyConn.Open() cmd.ExecuteNonQuery() MyConn.Close 'Put a label on your page to contain the 'success' response: lblMessage.Text = "Thank you for signing up. An email will be sent to you shortly." & _ "Your response will be needed from that email to activate your account" End Sub
uid
pwd
fullname
email
It looks like some sort of issue with the path to the Access database that you are using. As far as I'm aware the Server.MapPath works on the same file structure as your web pages would. Eg
../database/userId.mdb
instead ofC:\Documents and Settings\Joy.PHOENIX-1D0486C\Desktop\userId.mdb
. So put your database either in the root of your site or in a folder, named database, within the root like I have in my example path.