Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6922281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:23:09+00:00 2026-05-27T10:23:09+00:00

I tried to make my ODBC Connection within the class. here’s my class code

  • 0

I tried to make my ODBC Connection within the class.
here’s my class code

Public Class Library

    Public Function Seek(ByVal Connection As Odbc.OdbcConnection, ByVal TableName As String, ByVal Field As String, ByVal Index As Long)
        Dim LibDS As New DataSet
        Dim LibDA As Odbc.OdbcDataAdapter = New Odbc.OdbcDataAdapter("SELECT * FROM " & TableName & " WHERE " & Field & " = " & Index & "", Connection)

        Return LibDA.Fill(LibDS, TableName)
    End Function
End Class

…and here’s my form’s code.

    Dim LibDS1 As New DataSet

    LIbDS1 = Table.Seek(LibConn, "tblRoles", "UserID", varUserID.UserID)
    If LibDS1.Tables(0).Rows(0)("Role").ToString = "member" Then
        MsgBox("You are member")
    End If

Here’s my error: Unable to cast object of type ‘System.Int32’ to type ‘System.Data.DataSet’. I am using VBdotNet2005

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:23:09+00:00Added an answer on May 27, 2026 at 10:23 am

    Function returns Integer value but you want to return the DataSet.

    Public Function Seek(ByVal Connection As Odbc.OdbcConnection, 
               ByVal TableName As String, ByVal Field As String, ByVal Index As Long) 
                          as DataSet
      .....
      LibDA.Fill(LibDS, TableName)
      Return LibDs
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to make a function that takes a vector for an argument: class
I tried to make a program that has a correct Divide function. My code
I tried to make the title as clear as possible... here is my scenario:
I've tried to make a regex expression to match a piece of code, but
I tried to make this code perform faster using Parallel.ForEach and ConcurrentBag but it's
I tried to make a code that calculates the values of the formulas the
I tried to make a simple test with facebox_render and rails 3. Here are
Tried to make a little old school ajax (iframe-javascript) script. A bit of mootools
I tried to make an independent copy of an array but couldnt get one.
I tried to make a custom pushpin for the Bing Maps silverlight control, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.