Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Is any Record Set Concept is there in OLEDB

Is any Record Set Concept is there in OLEDB

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasecsswpfwcfquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Praveen 123
    wrote on last edited by
    #1

    I am having a Select Query which is suppose to select multipple records from a table (MS-Access). I am using OLEDB from my connection and using OLEDB Adapter and datasets to desplay data. But I want to perform an operation on Each records after selecting from the DB- Which I want to Diaplay to the Data Grid also. But By using the OLEDB i am unable to collect the information from the records before binding. Is any way there to take the records and operate on it before binding, and using OLEDB ? Dim con As OleDbConnection Dim cmd As OleDbCommand = New OleDbCommand Dim dataSet As dataSet = Nothing Sub BindGrid() Dim oleDbDataAdapter As OleDbDataAdapter = Nothing Dim ConnectionString = System.Configuration. _ ConfigurationSettings.AppSettings(ConConstant.MS_ACCESS_CONNECTION_STRING) ' Ge the sql query Dim SelectQueryText As String = String.Empty SelectQueryText = "Select Leave_Code as LeaveCode,Leave_Name as LeaveName,NoOfDays as Days from Leave_Mstr" oleDbDataAdapter = New OleDbDataAdapter(SelectQueryText, _ New OleDbConnection(ConnectionString)) ' Create the data set dataSet = New DataSet ' Fill the data set with the data oleDbDataAdapter.Fill(dataSet) If (Not oleDbDataAdapter Is Nothing) Then oleDbDataAdapter = Nothing End If With dgLeavCrtnLeavDtls .DataSource = dataSet .DataMember = dataSet.Tables(0).TableName .DataBind() End With End Sub Sub tablebind() Dim oleDbDataAdapter As OleDbDataAdapter = Nothing Dim ConnectionString = System.Configuration. _ ConfigurationSettings.AppSettings(ConConstant.MS_ACCESS_CONNECTION_STRING) ' Ge the sql query Dim SelectQueryText As String = String.Empty SelectQueryText = "Select Leave_Code as LeaveCode,Leave_Name as LeaveName,NoOfDays as Days from Leave_Mstr" oleDbDataAdapter = New OleDbDataAdapter(SelectQueryText, _ New OleDbConnection(ConnectionString)) ' Create the data set dataSet = New DataSet ' Fill the data set with the data oleDbDataAdapter.Fill(dataSet) Dim dh As TableHeaderCell Dim dc As DataColumn Dim dr As DataRow For Each dr In dataSet.Tables(0).Rows Dim trow As New TableRow For Each dc In dataSet.Tables(0).Columns Dim tcell As New TableCell tcell.Co

    S 1 Reply Last reply
    0
    • P Praveen 123

      I am having a Select Query which is suppose to select multipple records from a table (MS-Access). I am using OLEDB from my connection and using OLEDB Adapter and datasets to desplay data. But I want to perform an operation on Each records after selecting from the DB- Which I want to Diaplay to the Data Grid also. But By using the OLEDB i am unable to collect the information from the records before binding. Is any way there to take the records and operate on it before binding, and using OLEDB ? Dim con As OleDbConnection Dim cmd As OleDbCommand = New OleDbCommand Dim dataSet As dataSet = Nothing Sub BindGrid() Dim oleDbDataAdapter As OleDbDataAdapter = Nothing Dim ConnectionString = System.Configuration. _ ConfigurationSettings.AppSettings(ConConstant.MS_ACCESS_CONNECTION_STRING) ' Ge the sql query Dim SelectQueryText As String = String.Empty SelectQueryText = "Select Leave_Code as LeaveCode,Leave_Name as LeaveName,NoOfDays as Days from Leave_Mstr" oleDbDataAdapter = New OleDbDataAdapter(SelectQueryText, _ New OleDbConnection(ConnectionString)) ' Create the data set dataSet = New DataSet ' Fill the data set with the data oleDbDataAdapter.Fill(dataSet) If (Not oleDbDataAdapter Is Nothing) Then oleDbDataAdapter = Nothing End If With dgLeavCrtnLeavDtls .DataSource = dataSet .DataMember = dataSet.Tables(0).TableName .DataBind() End With End Sub Sub tablebind() Dim oleDbDataAdapter As OleDbDataAdapter = Nothing Dim ConnectionString = System.Configuration. _ ConfigurationSettings.AppSettings(ConConstant.MS_ACCESS_CONNECTION_STRING) ' Ge the sql query Dim SelectQueryText As String = String.Empty SelectQueryText = "Select Leave_Code as LeaveCode,Leave_Name as LeaveName,NoOfDays as Days from Leave_Mstr" oleDbDataAdapter = New OleDbDataAdapter(SelectQueryText, _ New OleDbConnection(ConnectionString)) ' Create the data set dataSet = New DataSet ' Fill the data set with the data oleDbDataAdapter.Fill(dataSet) Dim dh As TableHeaderCell Dim dc As DataColumn Dim dr As DataRow For Each dr In dataSet.Tables(0).Rows Dim trow As New TableRow For Each dc In dataSet.Tables(0).Columns Dim tcell As New TableCell tcell.Co

      S Offline
      S Offline
      Scott Dorman
      wrote on last edited by
      #2

      Instead of using the <code> tag, you should use the <pre> tag.

      Dim con As OleDbConnection
      Dim cmd As OleDbCommand = New OleDbCommand
      Dim dataSet As dataSet = Nothing

      Sub BindGrid()
      Dim oleDbDataAdapter As OleDbDataAdapter = Nothing
      Dim ConnectionString = _
      System.Configuration.ConfigurationSettings.AppSettings(ConConstant.MS_ACCESS_CONNECTION_STRING)

      ' Ge the sql query
      Dim SelectQueryText As String = String.Empty
      SelectQueryText = "Select Leave_Code as LeaveCode,Leave_Name as LeaveName,NoOfDays as Days from Leave_Mstr"
      oleDbDataAdapter = New OleDbDataAdapter(SelectQueryText, New OleDbConnection(ConnectionString))

      ' Create the data set
      dataSet = New DataSet

      ' Fill the data set with the data
      oleDbDataAdapter.Fill(dataSet)
      If (Not oleDbDataAdapter Is Nothing) Then
      oleDbDataAdapter = Nothing
      End If

      With dgLeavCrtnLeavDtls
      .DataSource = dataSet
      .DataMember = dataSet.Tables(0).TableName
      .DataBind()
      End With
      End Sub

      Sub tablebind()
      Dim oleDbDataAdapter As OleDbDataAdapter = Nothing
      Dim ConnectionString = _
      System.Configuration.ConfigurationSettings.AppSettings(ConConstant.MS_ACCESS_CONNECTION_STRING)

      ' Ge the sql query
      Dim SelectQueryText As String = String.Empty
      SelectQueryText = "Select Leave_Code as LeaveCode,Leave_Name as LeaveName,NoOfDays as Days from Leave_Mstr"
      oleDbDataAdapter = New OleDbDataAdapter(SelectQueryText, New OleDbConnection(ConnectionString))

      ' Create the data set
      dataSet = New DataSet

      ' Fill the data set with the data
      oleDbDataAdapter.Fill(dataSet)

      Dim dh As TableHeaderCell
      Dim dc As DataColumn
      Dim dr As DataRow

      For Each dr In dataSet.Tables(0).Rows
      Dim trow As New TableRow

        For Each dc In dataSet.Tables(0).Columns
           Dim tcell As New TableCell
           tcell.Controls.Add(New LiteralControl(dr(dc.ColumnName).ToString))
           trow.Cells.Add(tcell)
        Next
      

      Next
      End Sub

      Why do you have both of these functions? They do almost the same thing, except one tries to bind the data grid to the table and the other one looks like you are trying to copy the row to a new row. It's not entirely clear what you are trying to do or what the problem is that you are encountering.

      ----------------------------- In just two days, tomorrow will be yesterday. http://geekswithblogs.net/sdorman<

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups