Hai all
I wrote a common piece of code for inserting the records in a table using c#, i stored the control names in a Database table with the type of control, and the table field name will be same as control name so i retrived the values and build the string like
str1= "insert tablename colmn1,colmn2 values (cntrlname1.txt,cntrlname2.txt)"
cn.Open();
cmd.Connection = cn;
cmd.CommandText = str1.ToString();
cmd.ExecuteNonQuery();
cn.Close();
The above code inserts directly(cntrlname1.txt,cntrlname2.txt) instead of cntrlname1.txt,cntrlname2.txt values, but if i copy the str1 value and put
cmd.CommandText="insert tablename colmn1,colmn2 values (cntrlname1.txt,cntrlname2.txt)"
it correctly inserts the value of cntrlname1.txt,cntrlname2.txt
Please provide me some solution