Subject: Insert data in SQL ASP .NET 2.0.
Posted By: alexsaiz82 Post Date: 1/3/2006 2:28:55 PM
Good morning,

I don't know why this code is not inserting data in my SQL database. It automatically returns the same webpage, without any insert in the database.

Do you know where is the error?

Thanks in advance.
Alejandro Pérez.
SPAIN


<%@ Page Language="VB" Debug="true" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>
<form id="form1" method="post" runat="server">
<asp:SqlDataSource id="ds1" runat="server"
   ConnectionString="server=62.149.153.13;database=MSSql13067;uid=MSSql13067;pwd=secret"
   SelectCommand="SELECT [usuario], [email] FROM [usuarioyemail]"
   InsertCommand="INSERT INTO [usuarioyemail] ([usuario], [email]) VALUES (@usuariocontrol, @emailcontrol)"
>
<InsertParameters>
<asp:ControlParameter Name="usuariocontrol" ControlID="usuario" Type="Char" PropertyName="Text" />
<asp:ControlParameter Name="emailcontrol" ControlID="email" Type="Char" PropertyName="Text" />
</InsertParameters>
   </asp:SqlDataSource>
    <asp:TextBox ID="usuario" runat="server"></asp:TextBox>
    <asp:TextBox ID="email" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
</html>



Go to topic 10827

Return to index page 405
Return to index page 404
Return to index page 403
Return to index page 402
Return to index page 401
Return to index page 400
Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396