473,379 Members | 1,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

asp.net DataGrid e Update in SqlServer

Ciao Ragazzi,
sto impazzendo.
Ho un Datagrid popolato con dei dati.
Aggiungo il Tasto Edit per modificare la riga. Quando eseguo il codice
edito la riga e poi quando tento di fare l'update ottengo un errore ->
Must declare the scalar variable "@IdSpecie".
Questo è il codice:

<body>
<form id="form1" runat="server">
<div>
&nbsp;
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="IdSpecie"
HeaderText="IdSpecie" InsertVisible="False"
ReadOnly="True" SortExpression="IdSpecie" />
<asp:BoundField DataField="Famiglia"
HeaderText="Famiglia" SortExpression="Famiglia" />
<asp:BoundField DataField="SottoFamiglia"
HeaderText="SottoFamiglia" SortExpression="SottoFamiglia" />
<asp:BoundField DataField="DescSpecie"
HeaderText="DescSpecie" SortExpression="DescSpecie" />
<asp:BoundField DataField="NomeComune"
HeaderText="NomeComune" SortExpression="NomeComune" />
<asp:CommandField ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:phpbb_acquarioConnectionString
%>"
SelectCommand="SELECT [IdSpecie], [Famiglia],
[SottoFamiglia], [DescSpecie], [NomeComune] FROM[List_Specie]"
UpdateCommand="UPDATE List_Specie SET DescSpecie =
@DescSpecie, Famiglia = @Famiglia, NomeComune = @NomeComune,
SottoFamiglia = @SottoFamiglia WHERE (IdSpecie = @IdSpecie)">
</asp:SqlDataSource>

</div>
</form>
</body>
Da tutti gli esempi che ho trovato dovrebbe farsi così. Se aggiungo
gli update parameter:
<UpdateParameters>
<asp:Parameter Name="IdSpecie" />
</UpdateParameters>

Non ottengo più l'errore ma non salva i dati. il campo idSpecie è un
integer autoincrement.

Grazie

Oct 21 '07 #1
0 929

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gamze | last post by:
Hi, In my vb.net windows application ,i have combobox which is populated by sqlserver database table.When i select value from combobox ,value saved in to other table of my database and i use to...
0
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is...
7
by: Pierluigi Terzoli | last post by:
Hi everybody, I need help for this problem: I'm using a DataGrid to Insert/Modify/Cancel data from a single table. At the moment, every cell modification of a pre-existing row is correctly update...
0
by: Alan Z. Scharf | last post by:
Win Server 2003 VS.Net 2003 --------------- 1. I'm having the same problem below on all six of my pages with a datagrid item. 2. These pages all worked fine for months until problem started....
8
by: Sue | last post by:
I have a datagrid populated with 6 visible read-only labels and several hidden fields. Below the datagrid, I have a table with various textboxes, dropdowns, etc. I've managed to decypher the...
4
by: Price Brattin | last post by:
I dragged a datagrid onto a VB.Net WinForm and used the properties page and a few lines of code to set it up, including the DataSource. No wizard setup was used. It works fine except for one...
2
by: toddw607 | last post by:
Hi Everyone! I have a ASP.NET webform that brings data in from SQL Server 2000 and displays it on a page. I want to update the webpage while in IE using the following code: <%@ Import...
2
by: toddw607 | last post by:
Hi all! I am attempting to bring an SQL Server table into ASP.NET using the datagrid . I have set all cells to be a text box by which the user can just click on and edit the cell. I have a...
1
by: Amit | last post by:
Hello , Is there any way i can import data from datagrid to sqlserver. please advise . thanks & Regards
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.