Skip to main content

Posts

Showing posts with the label command types

How to fill grid in asp.net through code in function of class

How to fill grid in asp.net through code in function of class Public Function FillGrid() As DataTable Dim cmd As SqlCommand cmd = New SqlCommand("SP_SELECT_COLUMNNAMES", objCn.openDb()) cmd.CommandType = CommandType.StoredProcedure Dim dt As New DataTable("Dt") Dim da As New SqlDataAdapter(cmd) Try cmd.Parameters.Add(New SqlParameter("@COLUMNNAME", SqlDbType.VarChar, 1000, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, _ColumnName)) cmd.Parameters.Add(New SqlParameter("@TABLE", SqlDbType.Char, 300, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, _Table)) cmd.Parameters.Add(New SqlParameter("@CRITERIA", SqlDbType.Char, 2000, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, _Criteria)) 'Execute Query da.Fill(dt) 'da.Fill(dt) Dim Inti As Integer 'For Inti = 0 To dt.Columns.Count - 1 ' '