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

  • SEARCH
  • Home
  • 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 7491813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:10:48+00:00 2026-05-29T16:10:48+00:00

My problem is, when I query by a usual ID, like number with no

  • 0

My problem is, when I query by a usual ID, like number with no segments = 1234567890, it works nicely.

But I need to query by some kind of segmented values or ID as = 123-4567-890, when I try by 123-4567-890 this id it does not query anything in mysql although in the database this 123-4567-890 ID is present.

So what is the possible solution to search by segmented value in mysql in VB.NET

Here is below, my trying codes in vb

Public Sub student()

    textbox1.text= "123-4567-890"
    Try
        dbConn()
        Dim myAdapter As New MySqlDataAdapter("Select studentID, batchID, studentStatus from student where studentID= " & textbox1.text, ServerString)
        Dim myDataTable As New DataTable
        myAdapter.Fill(myDataTable)

        If myDataTable.Rows.Count > 0 Then
            vrSID = myDataTable.Rows(0).Item("studentID")
            vrRecBatchID = myDataTable.Rows(0).Item("batchID")
            vrAttendanceStatus = myDataTable.Rows(0).Item("studentStatus")

            If vrSID = vrIDD Then                    
                If vrAttendanceStatus = "Active" Then
                    Console.Beep()
                    batchRoutine()                        
                Else
                    led3()
                    Console.Beep()
                End If
            End If
        Else
            Console.Beep()
            teacher()
        End If
    Catch ex As Exception
        Console.Beep()
        MsgBox ("Error")
    End Try
End Sub
  • 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-29T16:10:49+00:00Added an answer on May 29, 2026 at 4:10 pm

    When you are running into problems, the easiest way to solve them is to break things down to the simplest scenario. So instead of complicating things with table adapters and data tables, see what happens when you just send MySQL the query you ‘think’ works correctly.

    So start out by seeing if you can get this to work, then go from there:

        Dim sql As String = "select id from mytable where id = '123-4567-890'"
        Using cnx As New MySqlConnection("connection_string")
            Using cmd As New MySqlCommand(sql, cnx)
                cnx.Open()
    
                Using reader As MySqlDataReader = cmd.ExecuteReader()
    
                    Debug.Assert(reader.Read(), "No results")
                    Trace.WriteLine(reader.GetValue(reader.Item(0)))
                End Using
            End Using
        End Using
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a query as usual but this time I need
Search for: 'chemist' Problem: query which will match a string like 'onechemist' but not
I've a nice situation, I think at beginning this a usual query but I'm
I'm sick of the following problem: I query the Facebooks API for some permissions
Problem: SQL query is generated after user input and number of columns can vary
Any ideas how to solve a query problem like give me names of all
I think this is a simple SQL query problem, but I am just not
Got a problem with a query I'm trying to write. I have a table
I'm having a problem with a query prepared in PHP with PDO. The code:
I have a problem with the query below in postgres SELECT u.username,l.description,l.ip,SUBSTRING(l.createdate,0,11) as createdate,l.action

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.