I have a code where it will store values from textbox to gridview temporarily without sending to database.
Now i have created a button,trying to send the values in temporary gridview to database.
Here's the cs code :
C# |
But i'm getting this error:
CS1061: 'System.Data.SqlClient.SqlCommand' does not contain a definition for 'Parameter' and no extension method 'Parameter' accepting a first argument of type 'System.Data.SqlClient.SqlCommand' could be found (are you missing a using directive or an assembly reference?)
Source error:
Code
cmd.Parameter.AddWithValue("@compName", row["name"].ToString());I tried to use command instead of cmd,but it still gives error.
Any ideas guys?
Code

Sam HobbsRank #108 · 20.5K reputationPosted Sep 17, 2010, 5:18 PM EDT
Parameter
Parameters
Do you see a difference? Now look at your code, the error message and the documentation.
sam147 reputationPosted Sep 19, 2010, 5:23 PM EDT
Hi.
Now i get another error :
ExecuteNonQuery: Connection property has not been initialized.
source line :
Even in my other applications get this error.And as i know,the code is just ok.But i dont know why getting this error.
Sam HobbsRank #108 · 20.5K reputationPosted Sep 19, 2010, 5:45 PM EDT