B
bic
Hi,
Within .NET Framework there is System.Data.SqlClient namespace and within
that there is SqlDataReader object that has a read method. As shown in the
code this read method can read in desired dataset and store it in a control
and display it. Instead of SQL Server data I am dealing with XML data file
and with XSL formatter and would like to know a compable way of reading in
desired XML data or nodes. Thanks
-----SQLreader--------
Dim MyConnection As SqlConnection
Dim MyCommand As SqlCommand
Dim MyReader As SqlDataReader
Dim CT1 As String
Dim CaseTrackConnectionString As String
CaseTrackConnectionString =
ConfigurationManager.ConnectionStrings("CollectionConnectionString").ConnectionString
MyConnection = New SqlConnection(CaseTrackConnectionString)
MyCommand = New SqlCommand
CT1 = "SELECT * FROM Driver WHERE DriverID='" +
DriverDropDownList.SelectedValue.ToString + "'"
MyCommand.CommandText = CT1
MyCommand.CommandType = CommandType.Text
MyCommand.Connection = MyConnection
MyCommand.Connection.Open()
MyReader = MyCommand.ExecuteReader(CommandBehavior.CloseConnection)
While MyReader.Read()
If MyReader("DriverMobile") IsNot System.DBNull.Value Then
DriverMobileLabel.Text = MyReader("DriverMobile")
EndIf
EndWhile
MyCommand.Dispose()
MyConnection.Close()
MyConnection.Dispose()
Within .NET Framework there is System.Data.SqlClient namespace and within
that there is SqlDataReader object that has a read method. As shown in the
code this read method can read in desired dataset and store it in a control
and display it. Instead of SQL Server data I am dealing with XML data file
and with XSL formatter and would like to know a compable way of reading in
desired XML data or nodes. Thanks
-----SQLreader--------
Dim MyConnection As SqlConnection
Dim MyCommand As SqlCommand
Dim MyReader As SqlDataReader
Dim CT1 As String
Dim CaseTrackConnectionString As String
CaseTrackConnectionString =
ConfigurationManager.ConnectionStrings("CollectionConnectionString").ConnectionString
MyConnection = New SqlConnection(CaseTrackConnectionString)
MyCommand = New SqlCommand
CT1 = "SELECT * FROM Driver WHERE DriverID='" +
DriverDropDownList.SelectedValue.ToString + "'"
MyCommand.CommandText = CT1
MyCommand.CommandType = CommandType.Text
MyCommand.Connection = MyConnection
MyCommand.Connection.Open()
MyReader = MyCommand.ExecuteReader(CommandBehavior.CloseConnection)
While MyReader.Read()
If MyReader("DriverMobile") IsNot System.DBNull.Value Then
DriverMobileLabel.Text = MyReader("DriverMobile")
EndIf
EndWhile
MyCommand.Dispose()
MyConnection.Close()
MyConnection.Dispose()