Click here to Skip to main content
15,899,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello People,

- i have used a details view so as to display the data from my table named "contacts" it has 2 columns "Contact" and "Name".

- I have used an SQL data source control: like this

SQLDATASOURCE control:
<asp:SqlDataSource ID="sql" runat="server" ConnectionString="<%$ ConnectionStrings:contacts %>"  UpdateCommand="update contacts set Name=@Name where Contact=@Contact" DeleteCommand="Delete from contacts where Contact=@Contact " InsertCommand="Insert into contacts (Name,Contact) values(@Name,@Contact)" SelectCommand="select Name,Contact from contacts" />


So after running this page i get an error :

Must declare the scalar variable "@Contact".

Kindly Advice
Thanks,
Posted
Updated 22-Aug-13 10:27am
v2
Comments
Richard C Bishop 22-Aug-13 16:27pm    
You are not passing a value for @Contact, it needs one.
Maarten Kools 22-Aug-13 16:28pm    
How are you specifying the query parameters to the datasource?
Rahul VB 22-Aug-13 16:38pm    
I have two fields :

Name, Contact
I have used details view for displaying these fields.
I have used Declarative data binding and here is the Details View control's code :


<asp:DetailsView id="dv" DataSourceID="sql" AllowPaging="true" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" AutoGenerateInsertButton="true" AutoGenerateRows="false" CssClass="detailsview" PagerSettings-Mode="NumericFirstLast" runat="server"><fields><asp:BoundField DataField="Name" HeaderText="Person Name" InsertVisible="true" /><asp:BoundField DataField="Contact" HeaderText="Contact" ReadOnly="false" />

- Can you please explain me the significance of "@" symbol?
- What is the difference in using the @ symbol for delete command vs all other commands.
- May be i have used it wrongly

Thanks,

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