Must declare the scalar variable '@FirstName'

G

Guest

Must declare the scalar variable '@FirstName'

ContactGridViewWebForm.aspx
<aspqlDataSource
RunAt="server"
ID="SqlDataSourceContact"

ConnectionString="server=localhost;database=WordEngineering;Integrated
Security=SSPI;"
ProviderName="System.Data.OleDb"
SelectCommand="SELECT SequenceOrderId, FirstName, LastName,
OtherName, Company FROM Contact ORDER BY SequenceOrderId"
UpdateCommand="UPDATE Contact SET FirstName=@FirstName,
LastName=@LastName, Company=@Company WHERE equenceOrderId=@SequenceOrderId"
href="mailtoequenceOrderId=@SequenceOrderId">SequenceOrderId=@SequenceOrderId"
/>

<asp:GridView
RunAt="server"
ID="GridViewContact"
AutoGenerateColumns=false
AutoGenerateEditButton=true
DataKeyField="SequenceOrderId"
AllowPaging="true"
AllowSorting="true"
ContactGridViewPage.aspx.cs
public string DatabaseConnectionString = "Provider=SQLOLEDB;Data
Source=localhost;Integrated Security=SSPI;Initial Catalog=WordEngineering;";
SqlDataSourceContact.ConnectionString = DatabaseConnectionString;
GridViewContact.DataSourceID = SqlDataSourceContact.ID;
 
K

Kevin Spencer

Take a look at your code. Do you see the string "@FirstName" anywhere?

Do you know what it is?

It's a parameter decaration. Where have you defined the parameter?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

Must declare the scalar variable '@FirstName' occurs when the user concludes
the edit mode by clicking the update button.

In the past, efforts to define the parameter have been unsuccessful, but
could you please share a working sample code example.

Thank you.
 
Joined
Aug 17, 2007
Messages
1
Reaction score
0
Just declare DataKeyNames="slno" in the GridView property. It will fix the issue. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top