Torna al Thread

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click If GridView1.SelectedIndex = -1 Then Exit Sub Dim TBordine As New DataTable querytemp = "Select * from Ordinazione where sessione = '" + ViewState("key") + "' order by numero" sqlcommand = New SQLiteCommand(querytemp, conn) TBordine.Load(sqlcommand.ExecuteReader) If TBordine.Rows.Count = 0 Then Dim prezzo As String = FormatNumber(GridView1.SelectedRow.Cells(4).Text, 2) prezzo = Replace(prezzo, ",", ".") querytemp = "Insert Into Ordinazione (sessione, numero,descrizione,maxi,prezzo,prz_supp,tot_pizza) VALUES ('" + ViewState("key") + "'," & TBordine.Rows.Count & ",'" + GridView1.SelectedRow.Cells(1).Text + "',1, '" & prezzo & "','','')" Else Dim prezzo As String = FormatNumber(GridView1.SelectedRow.Cells(4).Text, 2) prezzo = Replace(prezzo, ",", ".") querytemp = "Insert Into Ordinazione (sessione, numero,descrizione,maxi,prezzo,prz_supp,tot_pizza) VALUES ('" + ViewState("key") + "'," & TBordine.Rows(TBordine.Rows.Count - 1).Item(1) + 1 & ", '" + GridView1.SelectedRow.Cells(1).Text + "',1, '" & prezzo & "','','')" End If sqlcommand = New SQLiteCommand(querytemp, conn) sqlcommand.ExecuteNonQuery() querytemp = "Select * from ORdinazione where sessione = '" + ViewState("key") + "' order by numero" sqlcommand = New SQLiteCommand(querytemp, conn) TBordine.Clear() TBordine.Load(sqlcommand.ExecuteReader) GridView2.DataSource = TBordine GridView2.DataBind() Call formato_gridview2() End Sub
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5