Dim dt As New DataTable
dt.Load(dr) 範例:
Dim Conn As SqlConnection = DBLink .setConn("ConnectionString" )
Dim strSQL As String = ""
Dim cmd As SqlCommand = Nothing
Dim dr As SqlDataReader = Nothing
Try
strSQL = "SELECT * FROM Table"
cmd = New SqlCommand(strSQL, Conn)
dr = cmd.ExecuteReader
If dr.HasRows Then
Dim dt As New DataTable
dt.Load(dr)
Return dt
Else
Return Nothing
End If
Catch ex As Exception
Return Nothing
Finally
PublicFunction.iniDispose(cmd, dr, Conn)
End Try
0 意見:
張貼留言