unicode
-
Hi there, i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error: The name Var1 does not exist in the class or namespace of the project.... here is the codesnippet: string strsql; DataTable dt; SqlDataAdapter da; SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage"); dt = new DataTable(); strsql = "select * from Articles_production"; da = new SqlDataAdapter(strsql,objConn); da.Fill(dt); if(dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) //ervy loop for (int i=0;i
-
Hi there, i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error: The name Var1 does not exist in the class or namespace of the project.... here is the codesnippet: string strsql; DataTable dt; SqlDataAdapter da; SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage"); dt = new DataTable(); strsql = "select * from Articles_production"; da = new SqlDataAdapter(strsql,objConn); da.Fill(dt); if(dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) //ervy loop for (int i=0;i
If your code looks the way that it is posted. the for loop is incomplete.
-
If your code looks the way that it is posted. the for loop is incomplete.
-
If your code looks the way that it is posted. the for loop is incomplete.
-
Hi there, i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error: The name Var1 does not exist in the class or namespace of the project.... here is the codesnippet: string strsql; DataTable dt; SqlDataAdapter da; SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage"); dt = new DataTable(); strsql = "select * from Articles_production"; da = new SqlDataAdapter(strsql,objConn); da.Fill(dt); if(dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) //ervy loop for (int i=0;i
ybasha wrote:
'where identifier='" + Id +"'";
Unless your unique ID is a string, you need to remove the quotes. Christian Graus - Microsoft MVP - C++
-
Hi there, i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error: The name Var1 does not exist in the class or namespace of the project.... here is the codesnippet: string strsql; DataTable dt; SqlDataAdapter da; SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage"); dt = new DataTable(); strsql = "select * from Articles_production"; da = new SqlDataAdapter(strsql,objConn); da.Fill(dt); if(dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) //ervy loop for (int i=0;i
Since you didn't cut an paste the real code (as evidinced by the incomplete for statement) it is possible that the error message is correct: Var1 doesn't exist in the posted code. its var1... C# is after all case sensitive... This would be better done as a parameterized query anyway. Parameters have fewer issues with text characters (don't mind unescaped single quotes for instance) and so are less likely to give strange errors than dynamically built SQL. I notice that two or more of your replacements are replaceing unicode characters with double quotes, which likely totally corrupt the concatenated query sting (causing it to appear to terminate early). Using parameters would avoid that issue as well. Christian's observation is also likely a problem, and is another that would be avoided by using parameters. Building up SQL statements by concatenating stuff like this is bad practice for a number of reasons (increased garbage generation from all the string reallocations, vulnerability to SQL injection attack, etc). [edit] On top of all that, all the string variables (var1, var2, etc) are declared inside the scope of the for loop, and so do not exist outside of it (where your sql sting is declared and concatenated)...move the declarations to before the for loop, and this might have a chance [edit] Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke -- modified at 0:00 Wednesday 26th October, 2005
-
Hi there, i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error: The name Var1 does not exist in the class or namespace of the project.... here is the codesnippet: string strsql; DataTable dt; SqlDataAdapter da; SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage"); dt = new DataTable(); strsql = "select * from Articles_production"; da = new SqlDataAdapter(strsql,objConn); da.Fill(dt); if(dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) //ervy loop for (int i=0;i
-
Hi there, i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error: The name Var1 does not exist in the class or namespace of the project.... here is the codesnippet: string strsql; DataTable dt; SqlDataAdapter da; SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage"); dt = new DataTable(); strsql = "select * from Articles_production"; da = new SqlDataAdapter(strsql,objConn); da.Fill(dt); if(dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) //ervy loop for (int i=0;i
did you spell the variables correctly (i.e Var1 != var1)?
-
Hi there, i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error: The name Var1 does not exist in the class or namespace of the project.... here is the codesnippet: string strsql; DataTable dt; SqlDataAdapter da; SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage"); dt = new DataTable(); strsql = "select * from Articles_production"; da = new SqlDataAdapter(strsql,objConn); da.Fill(dt); if(dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) //ervy loop for (int i=0;i
Not really related to your question, but I hope you are aware that you can convert between code pages/encodings in a few lines (this looks like UTF-8 read as for example cp1252). If it is indeed the case do something like this: byte[] bytes = System.Text.Encoding.GetEncoding(1252).GetBytes(sourceString); string result = System.Text.Encoding.UTF8.GetString(bytes);