Advertisement

06.05.2008 at 12:16PM PDT, ID: 23461569
[x]
Attachment Details

simple asp.net form

Asked by sevensnake77 in Visual Studio 2008, Microsoft Applications, Microsoft Development

Tags: simple asp.net form

yes  have a form when you enter the information it goes into the database . but
keep getting and error

rocedure spdomInsertContacts has no parameters and arguments were supplied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Procedure spdomInsertContacts has no parameters and arguments were supplied.

Source Error:

Line 73:
Line 74:             conn.Open()
Line 75:             cmd.ExecuteNonQuery()
Line 76:

asp.net front end
<form id="form1" runat="server" enctype="multipart/form-data">
   
    <div align="justify">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    Name/Nombre: <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
    &nbsp;<asp:RequiredFieldValidator ControlToValidate="txtName" Text="Name/Nombre" ErrorMessage="Name/Nombre" runat="server" />
        <br />
        Address/Direccion:&nbsp;  <asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator  ControlToValidate="txtAddress" Text="Address" ErrorMessage="Address/Direccion" runat="server" /><br />
        Borough/Condado:&nbsp;
         <select id="txtServer" style="margin-top:15px" runat="server" unselectable="on"
            atomicselection="True" >
        <option>Please select</option>
        <option>Bronx</option>
        <option>Brooklyn</option>
        <option>Manhattan</option>
        <option>Queens</option>
        <option>Other</option>
        </select>&nbsp;<br />
        Zip Code/Zona Postal:&nbsp;         <asp:TextBox ID="txtZip" runat="server" MaxLength="5" Width="80px"></asp:TextBox>
        <asp:RequiredFieldValidator  ControlToValidate="txtZip" Text="Zip Code/Zona Postal" ErrorMessage="Zip Code/Zona Postal" runat="server"></asp:RequiredFieldValidator><br /><br />
       Home Phone/Telefono de la casa:&nbsp;&nbsp;
        <asp:TextBox ID="txthomeph" runat="server"></asp:TextBox>
       <asp:RequiredFieldValidator ID="RequiredFieldValidator1"  ControlToValidate="txthomeph" Text="Telephone/Telefono" ErrorMessage="Telephone/Telefono" runat="server"></asp:RequiredFieldValidator><br />
       Work phone/Telefono del:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txtworkphone" runat="server"></asp:TextBox><br />
       
           
             
       Name of Partner/Nombre de su pareja:&nbsp;&nbsp;<asp:TextBox ID="txtPartner" runat="server"></asp:TextBox><br />
     
      <asp:RadioButtonList ID="txtchoose1" RepeatDirection="Horizontal" runat="server" >
            <asp:ListItem Selected="True" Text="Single/Solo" Value="Single/Solo" ></asp:ListItem>
            <asp:ListItem Value="Team/Pareja" Selected="False" Text="Team/Pareja"></asp:ListItem>
            </asp:RadioButtonList>
        <div align="left">
       <asp:Button ID="Button1" runat="server" Text="Submit" />
         &nbsp;&nbsp;&nbsp;<input id="Clear" type="reset" value="Clear" />
            <asp:ValidationSummary CssClass="validate" ID="ValidationSummary1" ShowMessageBox="true"
    HeaderText="Please Correct the following fields:" runat="server"  />
    </div>
    </div>
   
    </form>

end here
store procedure

SET NOCOUNT ON
declare @Name VarChar(60)
declare @Address             varchar(250)
declare @Borough  varchar(50)
declare @ZipCode    char(15)
declare @HomePhone varchar(50)
declare @WorkPhone varchar(50)
declare @sinteam varchar(50)
declare @Partner varchar(250)
--SET IDENTITY_INSERT ominoSign] ON
INSERT INTO ominoSign]
           (Name
           ,Address
           ,Borough
           ,ZipCode
           ,HomePhone
           ,WorkPhone
           ,sinteam
           ,Partner)
     VALUES
           (@Name,
           @Address,
           @Borough,
           @ZipCode,
           @HomePhone,
           @WorkPhone,
           @sinteam,
           @PartnerStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        If IsValid Then
 
            Dim cmd As New SqlCommand("spdomInsertContacts", conn)
            cmd.CommandType = CommandType.StoredProcedure
 
            prm = New SqlParameter("@Name", SqlDbType.VarChar, 60)
            prm.Direction = ParameterDirection.Input
            prm.Value = Me.txtName.Text
            cmd.Parameters.Add(prm)
 
            prm = New SqlParameter("@Address", SqlDbType.VarChar, 250)
            prm.Direction = ParameterDirection.Input
            prm.Value = Me.txtAddress.Text
            cmd.Parameters.Add(prm)
 
            prm = New SqlParameter("@Borough", SqlDbType.VarChar, 50)
            prm.Direction = ParameterDirection.Input
            prm.Value = Me.txtServer.SelectedIndex
            cmd.Parameters.Add(prm)
 
            prm = New SqlParameter("@ZipCode", SqlDbType.Char, 15)
            prm.Direction = ParameterDirection.Input
            prm.Value = Me.txtZip.Text
            cmd.Parameters.Add(prm)
 
            prm = New SqlParameter("@HomePhone", SqlDbType.VarChar, 50)
            prm.Direction = ParameterDirection.Input
            prm.Value = Me.txthomeph.Text
            cmd.Parameters.Add(prm)
 
            prm = New SqlParameter("@WorkPhone", SqlDbType.VarChar, 50)
            prm.Direction = ParameterDirection.Input
            prm.Value = Me.txtworkphone.Text
            cmd.Parameters.Add(prm)
 
            prm = New SqlParameter("@sinteam", SqlDbType.VarChar, 50)
            prm.Direction = ParameterDirection.Input
            prm.Value = Me.txtPartner.Text
            cmd.Parameters.Add(prm)
 
            prm = New SqlParameter("@Partner", SqlDbType.VarChar, 50)
            prm.Direction = ParameterDirection.Input
            prm.Value = "choose"
            cmd.Parameters.Add(prm)
 
 
            conn.Open()
            cmd.ExecuteNonQuery()
 
            If conn.State <> ConnectionState.Closed Then conn.Close()
            If Not conn Is Nothing Then conn.Dispose()
            If Not cmd Is Nothing Then cmd.Dispose()
            prm = Nothing
            Response.Redirect("Thankyou.aspx")
        End If
[+][-]06.05.2008 at 02:24PM PDT, ID: 21724154

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio 2008, Microsoft Applications, Microsoft Development
Tags: simple asp.net form
Sign Up Now!
Solution Provided By: SStory
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.05.2008 at 06:19PM PDT, ID: 21725498

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906