Inserting Data Issue C#

I am trying the following code to insert data using C#.  The data does not get inserted and just refreshes.  Not sure if you guys/gals can see a problem that I am missing:

               string DescriptionValue = TextBox1.Text;
                string CategoryValue = DropDownList2.SelectedValue;
                System.Data.SqlClient.SqlConnection sqlConnection3 = new System.Data.SqlClient.SqlConnection("Data Source=my connection string");
                sqlConnection3.Open();
                
                System.Data.SqlClient.SqlCommand cmd2 = new System.Data.SqlClient.SqlCommand();
                cmd2.CommandType = System.Data.CommandType.Text;
                cmd2.CommandText = "INSERT Item (Barcode, Description, Store, StorePart, TotalOnHandNeeded, TotalEachLocationNeeded, TotalEachLocationNeeded2, Category, Type, WhereUsedFor, URL, Note) VALUES ('" + BarcodeValue + "', '" + DescriptionValue + "', Null, Null, Null, Null, Null, '" + CategoryValue + "', Null, Null, Null, Null)";
                cmd2.Connection = sqlConnection3;

                
                cmd2.ExecuteNonQuery();
                sqlConnection3.Close();
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Item Successfully Added');", true);
                Barcode.Text = "";
                DropDownList2.SelectedValue = "Select One";
                TextBox1.Text = ""; 

Open in new window

LVL 1
jjrr007Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mandeep SinghDatabase AdministratorCommented:
try

cmd2.CommandText = "INSERT into Item (Barcode, Description, Store, StorePart, TotalOnHandNeeded, TotalEachLocationNeeded, TotalEachLocationNeeded2, Category, Type, WhereUsedFor, URL, Note) VALUES ('" + BarcodeValue + "', '" + DescriptionValue + "', Null, Null, Null, Null, Null, '" + CategoryValue + "', Null, Null, Null, Null)";

Open in new window

0
jjrr007Author Commented:
I found the answer.  It was in the column name actually.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jjrr007Author Commented:
I found the answer on my own.  I had the wrong column name.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.