Torna al Thread

Dim WhereCondition As String = "" Dim ctrl As Control For Each ctrl In Me.Panel1.Controls If TypeOf (ctrl) Is TextBox Then If Not CType(ctrl, TextBox).Text.Equals("") Then WhereCondition = WhereCondition & CType(ctrl, TextBox).Tag.ToString() & " LIKE @" & CType(ctrl, TextBox).Tag.ToString() & " AND " cmd.Parameters.AddWithValue("@" & CType(ctrl, TextBox).Tag.ToString(), CType(ctrl, TextBox).Text) End If End If Next WhereCondition = WhereCondition.Trim() If WhereCondition.ToUpper().EndsWith("AND") Then WhereCondition = WhereCondition.Remove(WhereCondition.Length - 3, 3) End If cmd.SelectCommand = "SELECT * FROM tbMacchinario WHERE " & WhereCondition & ";",conn)
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5