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
  1. Home
  2. General Programming
  3. Visual Basic
  4. sqlexception

sqlexception

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
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.
  • M Offline
    M Offline
    monika_vasvani
    wrote on last edited by
    #1

    Hi I have written query like: dim str as string="true" Dim cmd As New OleDb.OleDbCommand("Select max(Invoice_No) from Invoice where flag= '" & str & "'", cn) cn.Open If IsDBNull(cmd.ExecuteScalar()) = True Then This statment fires exception:"No value given for one or more required parameters." when i fire this query directly from access,it runs successfully what is actual problem,i don't understand Thanks monika

    T 1 Reply Last reply
    0
    • M monika_vasvani

      Hi I have written query like: dim str as string="true" Dim cmd As New OleDb.OleDbCommand("Select max(Invoice_No) from Invoice where flag= '" & str & "'", cn) cn.Open If IsDBNull(cmd.ExecuteScalar()) = True Then This statment fires exception:"No value given for one or more required parameters." when i fire this query directly from access,it runs successfully what is actual problem,i don't understand Thanks monika

      T Offline
      T Offline
      Tom Deketelaere
      wrote on last edited by
      #2

      There are a few possible problem's 1: flag if this is a yes/no field in access (wich I assume it is) then the ' are not allowed so you'r query would be : (Select max(Invoice_No) from invoice where flag=" & str , cn) 2: there could be something wrong with you'r connection (cn) have you tested this? (easy to do with a simple "select invoice_no from invoice") hope this helps

      If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistakes.

      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