Salve a tutti
Sto provando a costruire il mio primo script in asp.net, solo che ho qualche problema...
Ho scritto questo:
la lettura dei records nella colonna voto riesco a farla, ma non riesco ad aggiungere nessun dato con la SQL Insert INTO...codice:<%@ Page Language="VB" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <script runat="server"> Sub Visualizza(ByVal obj As Object, ByVal e As EventArgs) Dim Conn As New OleDbConnection( _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Documents and Settings\utente\Documenti\Visual Studio 2005\WebSites\mdb-database\sonda.mdb") Dim ds As New DataSet("MyDataSet") Dim objCmd As New OleDbDataAdapter("SELECT * FROM sondaggio", Conn) objCmd.Fill(ds, "sondaggio") objCmd.InsertCommand = New OleDbCommand objCmd.InsertCommand.CommandText = "Insert INTO sondaggio (voto) VALUE ('risposta.SelectedValue')" objCmd.InsertCommand.Connection = Conn objCmd.Update(ds, "sondaggio") vis.Text = "hai scelto la risposta: " & risposta.SelectedValue End Sub Sub Leggi(ByVal obj As Object, ByVal e As EventArgs) Dim objConn As New OleDbConnection( _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Documents and Settings\utente\Documenti\Visual Studio 2005\WebSites\mdb-database\sonda.mdb") Dim objCmd As New OleDbCommand("SELECT voto FROM sondaggio", objConn) Dim objReader As OleDbDataReader objConn.Open() objReader = objCmd.ExecuteReader While objReader.Read Response.Write(objReader.GetString(0) & " ") End While objConn.Close() End Sub </script> </head> <body> <form id="form1" runat="server"> <div> <font face="arial" size="3pt">Domanda</font> <asp:RadioButtonList ID="risposta" runat="server"> <asp:ListItem Text="Risposta 1" Value="a" /> <asp:ListItem Text="Risposta 2" Value="b" /> <asp:ListItem Text="Risposta 3" Value="c" /> <asp:ListItem Text="Risposta 4" Value="d" /> </asp:RadioButtonList> <asp:Button ID="Button1" onclick="Visualizza" runat="server" Text="Invia" /> <asp:Button ID="Button2" onclick="Leggi" runat="server" Text="Leggi" /> </div> </form> <asp:Label ID="vis" runat="server"></asp:Label> </body> </html>
perchè?
Non mi da nessun errore, ma non scrive nemmeno.
Grazie

Rispondi quotando
si ma.... che errore?
VVoVe: argh... VALUES e non VALUE !!