0

OK, one last thing. Now I have 3 textboxes and here's what I wrote:

SqlConnection conn = new SqlConnection();
        conn.ConnectionString = "data source=.;initial catalog=ForumDataBase;integrated security=true;";
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = "INSERT INTO PostTable(ThreadTitle,PostMessage,UserName)
        values('"+ThreadTextBox.Value+"','"+PostTextBox.Value+"','"+NameTextBox.Value+"')";
        cmd.Connection = conn;
        conn.Open();
        cmd.ExecuteNonQuery();
        conn.Close();

Can you please tell me what's wrong with the INSERT INTO statement? I'm kinda confused with all these single and double quotation marks etc. Or maybe the connectionString has some problems?

1
Contributor
1
Reply
3
Views
9 Years
Discussion Span
Last Post by Wiizl
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.