Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
               grdView.EditIndex = -1;
        ShowGridBindData();


}

I got Error in this line daq.Fill(ds, "db");
Posted
Updated 28-Nov-11 4:57am
v3
Comments
2011999 28-Nov-11 8:06am    
SqlException was Unhandle by user code

Incorrect syntax near 'No'

Apart from what Anuj Banka already stated: Your SQL statement is assembled by string concatenation operations and is thus prone to SQL injection attacks. Your problem most likely arises from the fact that somewhere inside a comment or a mark there is a single quote character which will corrupt your naively constructed SQL. Use the SqlCommand[^].Parameters[^] in conjunction with the SqlParameter[^] class.

Regards,

—MRB
 
Share this answer
 
 
Share this answer
 
You are filling your dataset with Update sql query it will return you nothing..
 
Share this answer
 
Comments
2011999 28-Nov-11 8:09am    
what next what i will do
2011999 28-Nov-11 8:09am    
Please correct this code
[no name] 28-Nov-11 8:14am    
You correct it. It is your code.

YOu should never be using string concatenation to format a sql statement. Read about SQL Injection attacks and you will understand.
Anuj Banka 28-Nov-11 8:23am    
Subbu What Actually you are tring to do?

Do you want bulk update? You are looping through each row of the grid but your data for updation is same for each row.

Just tell me what output you want from this code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900