Results 1 to 6 of 6

Thread: Dataset not being populated by adapter

  1. #1

    Thread Starter
    Lively Member markmyb's Avatar
    Join Date
    Nov 2001
    Location
    Alberton - South Africa
    Posts
    108

    Dataset not being populated by adapter

    This is a sub within a class called DataSource:
    Public Sub FillDataSet(ByRef oDataSet As DataSet, ByVal FillWith As eFill, Optional ByVal sWhere As String = "")
    Dim oCommand As New OleDbCommand
    Dim oAdapter As New OleDbDataAdapter
    Dim s As String
    Try
    If OpenConnection() Then
    oCommand.Connection = mConnection
    oCommand.CommandType = CommandType.Text
    Select Case FillWith
    Case eFill.Colour
    If oDataSet.Tables.Contains("ColourVarients") Then oDataSet.Tables.Remove("ColourVarients")
    s = "select ColourVarientID, ColourVarientDescription " _
    & "from ColourVarients where SubSpeciesID = " & CType(IIf(sWhere = "", 0, sWhere), Integer) & " " _
    & "order by ColourVarientDescription"
    Case eFill.Species
    If oDataSet.Tables.Contains("Species") Then oDataSet.Tables.Remove("Species")
    s = "select SpeciesID, SpeciesDescription from Species order by SpeciesDescription"
    Case eFill.Status
    If oDataSet.Tables.Contains("Statuses") Then oDataSet.Tables.Remove("Statuses")
    s = "select StatusID, StatusDescription from Statuses order by StatusDescription"
    Case eFill.SupSpecies
    If oDataSet.Tables.Contains("SubSpecies") Then oDataSet.Tables.Remove("SubSpecies")
    s = "select SubSpeciesID, CommonName " _
    & "from SubSpecies where SpeciesID = " & CType(IIf(sWhere = "", 0, sWhere), Integer) & " " _
    & "order by CommonName"
    End Select
    oCommand.CommandText = s
    End If

    oAdapter.SelectCommand = oCommand
    oAdapter.Fill(oDataSet)
    Catch ex As Exception
    ErrorMessage(meName & " - " & "FillDataSet")
    Finally
    oCommand.Dispose()
    oCommand = Nothing
    oAdapter.Dispose()
    oAdapter = Nothing
    ' CloseConnection()
    End Try
    End Sub
    This is the calling procedure
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim cData As New cDataSource
    cData.FillDataSet(DataSet1, cDataSource.eFill.Species)
    cData.FillDataSet(DataSet1, cDataSource.eFill.Status)
    cData.CloseConnection()
    cData = Nothing
    End Sub
    problem being that the dataset is not being populated with the 2 tables.

    help please...
    Confusios say "Man who run in front of car get tired."

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  3. #3

    Thread Starter
    Lively Member markmyb's Avatar
    Join Date
    Nov 2001
    Location
    Alberton - South Africa
    Posts
    108
    is there a problem with that rar.
    As all thats in there is AssemblyInfo.vb

    ??
    Confusios say "Man who run in front of car get tired."

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by markmyb
    is there a problem with that rar.
    As all thats in there is AssemblyInfo.vb

    ??
    If you have Winrar program , then you can unpack it . The proj files plus db .

  5. #5

    Thread Starter
    Lively Member markmyb's Avatar
    Join Date
    Nov 2001
    Location
    Alberton - South Africa
    Posts
    108
    oops, was using winace...
    Confusios say "Man who run in front of car get tired."

  6. #6

    Thread Starter
    Lively Member markmyb's Avatar
    Join Date
    Nov 2001
    Location
    Alberton - South Africa
    Posts
    108
    Pirate!
    you da bomb mate....

    never knew about the tablemapping thing.


    Confusios say "Man who run in front of car get tired."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width