This is my first foray into the world of programming. I'm doing a practice project for the consulting firm I work for, and my current objective is to make my submission page textboxes insert the user input into specific tables in my database. Later I'll need to retrieve the data, but for now it suffices to get the data to go where it's supposed to. Why won't the data go into it's home? Doesn't it like it's home?

My code is below. I'm working with VS2010, code behind in C#, with SQLEXPRESS 2005. When I debug, punch in sample input and submit, I find no changes in the table data. Ideas?

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SubmissionPage : System.Web.UI.Page
    //public SqlConnection sqlConn = new SqlConnection("'data source=.\\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\\ArgonautDatabase;User Instance=true' providerName='System.Data.SqlClient'");

   // public SqlConnection sqlConn = new SqlConnection(".\\SQLEXPRESS;AttachDbFilename='|DataDirectory|\\ArgonautDatabase.mdf';Integrated Security=True;User Instance=True;");
    //public SqlConnection sqlConn = new SqlConnection(".\\SQLEXPRESS;AttachDbFilename='C:\\Users\\Brazos\\Documents\\Visual Studio 2010\\Projects\\Argonaut Insurance Site\\Argonaut Insurance Site\\App_Data\\ArgonautDatabase.mdf';Integrated Security=True;User Instance=True;");
    protected void Page_Load(object sender, EventArgs e)
    protected void Button1_Click(object sender, EventArgs e)
        System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection();
       // sqlConn.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\aspnetdb.mdf;Integrated Security=True;User Instance=True";
       sqlConn.ConnectionString = " Data Source = .\\SQLEXPRESS; Initial Catalog = Submission; User Id = sa; Password = sa";

        SqlCommand sqlComm = new SqlCommand();
        sqlComm = sqlConn.CreateCommand();
        sqlComm.CommandText = @"INSERT INTO Customer (" + " Name, SIC_NAIC, Address, City, State, Zip, " + ") VALUES (" + " Textbox1.Text, RadioButtonList1.SelecedItem, TextBox2.Text, DropDownList1.SelectedItem, TextBox3.Text" +
        sqlComm.CommandText = @"INSERT INTO Broker (" + " Name, Broker_Id, Address, City, State, Zip, Entity_Type" + ") VALUES (" + " TextBox5.Text, TextBox18.Text, TextBox6.Text, TextBox7.Text, DropDownList2.Text, TextBox8.Text, DropDownList3.Text" +


Please try posting in the .NET forums. This section is for Classic ASP.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.