473,585 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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"
AutoGenerateCol umns="False" DataSourceID="S qlDataSource1">
<Columns>
<asp:BoundFie ld DataField="IdSp ecie"
HeaderText="IdS pecie" InsertVisible=" False"
ReadOnly="True" SortExpression= "IdSpecie" />
<asp:BoundFie ld DataField="Fami glia"
HeaderText="Fam iglia" SortExpression= "Famiglia" />
<asp:BoundFie ld DataField="Sott oFamiglia"
HeaderText="Sot toFamiglia" SortExpression= "SottoFamig lia" />
<asp:BoundFie ld DataField="Desc Specie"
HeaderText="Des cSpecie" SortExpression= "DescSpecie " />
<asp:BoundFie ld DataField="Nome Comune"
HeaderText="Nom eComune" SortExpression= "NomeComune " />
<asp:CommandFie ld ShowEditButton= "True" />
</Columns>
</asp:GridView>
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:phpbb_acquar ioConnectionStr ing
%>"
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:SqlDataSour ce>

</div>
</form>
</body>
Da tutti gli esempi che ho trovato dovrebbe farsi così. Se aggiungo
gli update parameter:
<UpdateParamete rs>
<asp:Paramete r Name="IdSpecie" />
</UpdateParameter s>

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

Grazie

Oct 21 '07 #1
0 937

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

Similar topics

0
1410
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 datagrid to show this table. Myproblem is , i want to get text value from datagrid and my combobox should select this value (Which i selected...
0
1985
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 populated by sqlserver database table.When i select value from combobox ,value saved in to other table of my database and i use to datagrid to show...
7
2688
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 on the DB. I have some doubts about inserting a new row. The table has a Id field that is a primary key defined ad Identity properties on...
0
1678
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. 3. Same problem on two different computers running Win 2003.
8
3041
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 client-side coding needed for the user to click a "select" button (HTMLButton) in column 0 of the datagrid and have the table objects auto-fill with...
4
4395
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 thing: there is no vertical scrollbar even there are more lines than can be shown on the datagrid. There is plenty room on the right for the scrollbar...
2
4363
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 Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="System.Data.OleDb" %> <html>
2
3872
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 save button and when I click the save button the page reloads and the new data is in the cell, however when I close out and come back in the data is no...
1
4028
by: Amit | last post by:
Hello , Is there any way i can import data from datagrid to sqlserver. please advise . thanks & Regards
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8336
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.