Invalid column
-
i got error : Invalid column name 'A1009'.
chk1 = "select Sno from Student where SID = "+ @smemno.Text.ToString(); SqlCommand ck1 = new SqlCommand(chk1, cn); v11 = (string)ck1.ExecuteScalar();
what should i do?
-
i got error : Invalid column name 'A1009'.
chk1 = "select Sno from Student where SID = "+ @smemno.Text.ToString(); SqlCommand ck1 = new SqlCommand(chk1, cn); v11 = (string)ck1.ExecuteScalar();
what should i do?
Paresh1462 wrote:
what should i do?
Realize that we are not looking over your shoulder. Give an accurate description of the conditions, your problem, expected outcome and what you have tried. Without knowing your database structure or what it is populated with how can we tell what column A1009 means?
I know the language. I've read a book. - _Madmatt
-
i got error : Invalid column name 'A1009'.
chk1 = "select Sno from Student where SID = "+ @smemno.Text.ToString(); SqlCommand ck1 = new SqlCommand(chk1, cn); v11 = (string)ck1.ExecuteScalar();
what should i do?
-
i got error : Invalid column name 'A1009'.
chk1 = "select Sno from Student where SID = "+ @smemno.Text.ToString(); SqlCommand ck1 = new SqlCommand(chk1, cn); v11 = (string)ck1.ExecuteScalar();
what should i do?
For a start, I would look to change your code to mitigate the chance that you will be left wide open to a Sql Injection attack[^]. Secondly, I would look to
Dispose
of mySqlCommand
object. Wrapping it in a niceusing
statement will do the trick.I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads
-
i got error : Invalid column name 'A1009'.
chk1 = "select Sno from Student where SID = "+ @smemno.Text.ToString(); SqlCommand ck1 = new SqlCommand(chk1, cn); v11 = (string)ck1.ExecuteScalar();
what should i do?
As already pointed out, use parameters: SqlParameter[^]. But if you still for some reason want to use literals in SQL statements, add apostrophes when you're adding texts to the statement:
chk1 = "select Sno from Student where SID = '"+ @smemno.Text.ToString() + "'";
The need to optimize rises from a bad design.My articles[^]