数据表返回正确数量的行/记录。但由于某种原因,我无法让我的 GridView 渲染..根本没有显示......
编辑: GridView 返回“RowErorrs”和“有错误”列。但不是我的数据。
Dim ConnString As String = System.Configuration.ConfigurationManager.ConnectionStrings("oakfratintdbConnectionString").ConnectionString
Dim Conn As New SqlConnection(ConnString)
Dim cmd As New SqlCommand("SELECT * FROM [OFCInterments]", Conn)
Dim DA As New SqlDataAdapter(cmd)
Dim DT As New DataTable
'WHERE ([FirstName] = @FirstName)
cmd.Parameters.AddWithValue("@FirstName", "Mike")
Try
Conn.Open()
DA.SelectCommand = cmd
DA.Fill(DT)
GridView1.DataSource = DT
GridView1.DataBind()
If DT.Rows.Count > 0 Then
Dim NoResultsText As String = DT.Rows.Count.ToString + " records found."
txtStatys.Text = NoResultsText
txtStatys.Visible = True
End If
Catch ex As Exception
Throw ex
Finally
Conn.Close()
DA.Dispose()
Conn.Dispose()
End Try