aspx registration form

Discussion in 'Software' started by sarahpeebles, Nov 23, 2010.

  1. sarahpeebles

    sarahpeebles Private E-2

    Hey Guys
    I'm using visual web developer to create a aspx registration form that sends the form data to an access database.
    I am really knew to this but i have some code written out, But when all fields are entered properly instead of adding information to the database it goes straight to catch as exception.
    I think my poblems is in these bits of the code "txtfirstname.Text & "', '" & _"
    Help would be very much appretiated.
    Thanks!






    <%@ Page Language="VB" %>
    <%@ import Namespace="system.data" %>
    <%@ Import Namespace="System.Data.oledb" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
    Dim conn As New OleDbConnection("provider=microsoft.Jet.OLEDB.4.0;" & _
    "Data source=" & AppDomain.CurrentDomain.BaseDirectory & "App_Data\webproject1.mdb")
    Dim sqlcomand As New OleDbCommand

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

    sqlcomand.Connection = conn
    sqlcomand.Connection.Open()
    Try
    sqlcomand.CommandText = "insert into Registration " & _
    "(FirstName,LastName,Age,Gender,Address,PostCode,Email,UserName,Password) Values " & "('" & _
    txtfirstname.Text & "', '" & _
    txtlastname.Text & "', '" & _
    txtage.Text & "', '" & _
    txtgender.Text & "', '" & _
    txtadress.Text & "', '" & _
    txtemail.Text & "', '" & _
    txtusername.Text & "', '" & _
    txtpassword.Text & "')"
    sqlcomand.ExecuteNonQuery()
    MsgBox("thanks for registering please login")

    Catch ex As Exception
    MsgBox ("Error you cannot register")
    End Try
    End Sub
     
  2. enull

    enull Private E-2

    First, you'll need to either remove the Try - Catch - End Try temporarily or Step Through the execution in debug mode to find out what exactly is throwing the exception. While I see plenty of things that COULD be problems, I don't plainly see a syntax error.

    My guess is the error is actually when you run this against the database ( the sqlcomand.ExecuteNonQuery() line ).
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds