Hello all. I wasn't sure if I should post this here or under DB?
I'm a PHP user that is new to C#/ASP.NET/MS SQL.
I have a table with rows of string values (not sure why they were made strings as they are numbers but thats what they are).
I have a variable TheNumber that is Int. I am trying to convert that to string and insert it into the DB but I keep getting the type clash error. DBConnection is previously defined with the correct connection string.
Here is the code (the error is on the 2nd to last line that starts WriteToDB:
DBConnection.Open();
string TempTheNumber = Convert.ToString(TheNumber);
String MyString = @"INSERT INTO assignedaccountnums VALUES(" + TempTheNumber + ")";
SqlCommand WriteToDB = new SqlCommand(MyString, DBConnection);
WriteToDB.ExecuteNonQuery();
DBConnection.Close();
Any help would be appreciated!