S
sean
Hi,
I am filling a datagrid and I was wondering how I can test for "end of file"
and then make decisions based on that. I am still making the transition from
asp to asp.net.
Could someone help me with the syntax please?
Thanks in advance for youe answer
Sean
Dim Conn As OleDbConnection
Dim Rdr As OleDbDataReader
Try
Dim strConn As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
strConn &= Server.MapPath("clicks.mdb") & ";"
Dim strSQL As String
strSQL = "select FirstName from newsletter where FirstName='sean'"
Conn = New OleDbConnection(strConn)
Dim Cmd As New OleDbCommand(strSQL, Conn)
Conn.Open()
Rdr = Cmd.ExecuteReader()
MyDataGrid.DataSource = Rdr
MyDataGrid.DataBind()
Catch exc1 As Exception
Label1.Text = exc1.ToString()
Finally
If Not (Rdr Is Nothing) Then
If Rdr.IsClosed = False Then Rdr.Close()
End If
If Not (Conn Is Nothing) Then
If Conn.State = System.Data.ConnectionState.Open Then Conn.Close()
End If
End Try
I am filling a datagrid and I was wondering how I can test for "end of file"
and then make decisions based on that. I am still making the transition from
asp to asp.net.
Could someone help me with the syntax please?
Thanks in advance for youe answer
Sean
Dim Conn As OleDbConnection
Dim Rdr As OleDbDataReader
Try
Dim strConn As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
strConn &= Server.MapPath("clicks.mdb") & ";"
Dim strSQL As String
strSQL = "select FirstName from newsletter where FirstName='sean'"
Conn = New OleDbConnection(strConn)
Dim Cmd As New OleDbCommand(strSQL, Conn)
Conn.Open()
Rdr = Cmd.ExecuteReader()
MyDataGrid.DataSource = Rdr
MyDataGrid.DataBind()
Catch exc1 As Exception
Label1.Text = exc1.ToString()
Finally
If Not (Rdr Is Nothing) Then
If Rdr.IsClosed = False Then Rdr.Close()
End If
If Not (Conn Is Nothing) Then
If Conn.State = System.Data.ConnectionState.Open Then Conn.Close()
End If
End Try