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 6161057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:25:07+00:00 2026-05-23T21:25:07+00:00

Dim command_sbsp As New OleDbCommand(SELECT * FROM SNOMED_ORG_INFO WHERE ConceptID=@ID AND Genus=’SALMONELLA’ AND SubSpecies=@Subsp,

  • 0
Dim command_sbsp As New OleDbCommand("SELECT * FROM SNOMED_ORG_INFO WHERE ConceptID=@ID AND Genus='SALMONELLA' AND SubSpecies=@Subsp", SNOMED_DB)

For Each match As Long In choices
 command_sbsp.Parameters.Clear()
 command_sbsp.Parameters.AddWithValue("@Subsp", word)
 command_sbsp.Parameters.AddWithValue("@ID", match)

The above doesn’t work. The query attempt says there’s nothing that matches that. But when I try it as a simple string concatenation, it works fine.

command_sbsp = New OleDbCommand("SELECT * FROM SNOMED_ORG_INFO WHERE ConceptID=" + match.ToString + " AND Genus='SALMONELLA' AND SubSpecies='" + word + "'", SNOMED_DB)

Myself and a coworker have stared at this quite a lot and we can’t figure out why it’s not working. The problem is in the value for @ID (since it still works when I leave the other one parameterized). The funny thing is, Just a few lines of code above it I have a different query that sets a parameterized value for the same ID, using the the same choices list that the For Each loop is getting the match variable from.

Choices is a list of longs, and when I use choices(0) to parameterize ID in a query, it works. But now down here in this loop I have the new match long, and it doesn’t want to make it work for me. Any thoughts?

  • 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-23T21:25:07+00:00Added an answer on May 23, 2026 at 9:25 pm

    Despite the fact that the OLEDB class can use named parameters, it is actually just using a ‘?’ marker in the background, so the parameters are in INDEX order. Your sql has the ID variable occurring before the Subsp variable.

    Switch it around, like so:

    For Each match As Long In choices
     command_sbsp.Parameters.Clear()
     command_sbsp.Parameters.AddWithValue("@ID", match)
     command_sbsp.Parameters.AddWithValue("@Subsp", word)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dim sql As String = Select ProductID From OrderDetail Order By ProductID Desc Dim
Private Sub Command1_Click() Dim dom As New DOMDocument Dim http As New XMLHTTP Dim
For example, I write a method: Private Sub Command1_Click() Dim dom As New DOMDocument
Dim objMail As New Mail.MailMessage(no-reply@mywebsite.com, ToEmail, Password Reset, body) ...and the problem is that
Dim MyQuery = From c In xdoc.Descendants() _ Where c.Attribute(OriginY) IsNot Nothing _ Order
Public Shared Function GetData(ByVal id As Integer) As List(Of SomeClass) Dim command As New
I am using the following Shared Function to select a value from DB.My concern
how do start/stop services using net stop command in c# for example Dim pstart
Private Sub Command1_Click() Dim x As Integer For x = 1 To 100 List1.AddItem
Dim dtmStart As Date, dtmEnd As Date, dblDuration As Double dtmStart = 1900/01/01 08:10:00

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.