0

Hi All Experts,

Actually I am VB.Net Windows Application Developer Now i am going an ASP.Net Application. So, the Problem is that in Windows Application i Code this Project like given Below Actually i am Using SQL Server as DataBase and Store Procedure as Query.
Becuase i had tried to control the ASP.Net Data Grid with Loop and i Failed to Control it with this method so can any one Help me.
(Can any one Help that how can i Solve this Problem in ASP.Net)

Private Sub btn_Ok_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles btn_Ok.Click
Fill_dataset("Sel_MovNames", "Tbl_MovNames", Convert.toint32(cmb_MovID.SelectedValue))
      For rowcnt As Integer = 0 To ds.Tables("Tbl_MovNames").Rows.Count - 1
        dg_Movies.Rows.Add()
        dg_Movies.Item("col_SrNo", dg_Movies.RowCount - 2).Value = rowcnt + 1
        dg_Movies.Item("col_MovID", dg_Movies.RowCount - 2).Value = ds.Tables("Tbl_MovNames").Rows(rowcnt)("MovID").ToString
        dg_Movies.Item("col_MovName", dg_Movies.RowCount - 2).Value = ds.Tables("Tbl_MovNames").Rows(rowcnt)("MovName").ToString
        dg_Movies.Item("col_MovYear", dg_Movies.RowCount - 2).Value = ds.Tables("Tbl_MovNames").Rows(rowcnt)("MovYear").ToString
        dg_Movies.Item("col_MovViews", dg_Movies.RowCount - 2).Value = ds.Tables("Tbl_MovNames").Rows(rowcnt)("Views").ToString
     Next
 End Sub
 
Private Sub Fill_dataset(ByVal SPName As String, ByVal TableName As String, ByVal arg1 As Integer)
        SPName = SPName & " '" & arg1 & "'"
        myAdapter = New SqlDataAdapter(SPName, SQLCon)
        myAdapter.Fill(ds, TableName)
        ds.Tables(TableName).Clear()
        myAdapter.Fill(ds, TableName)
End Sub
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by prashantchalise
0

I guess using the following will be much easier.

dg_Movies.DataSource = ds.Tables("Tbl_MovNames").DefaultView()
dg_Movies.DataBind()
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.