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. Database & SysAdmin
  3. Database
  4. plz tell how to get rid of database error?

plz tell how to get rid of database error?

Scheduled Pinned Locked Moved Database
csharpdatabasequestionvisual-studiohelp
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.
  • D Offline
    D Offline
    drmzunlimited
    wrote on last edited by
    #1

    dim str as string str= "INSERT INTO employees Values(@ID,@FN,@LN)" dim InsCom as new SqlCommand(str,SqlConnection1) plz tell me what is the error in this code. MS Visual Studio.NEt shows error in the following SqlCommand function. when i write this line dim InsCom as new sqlcommand(str,Sqlconnection1) then after new the window pops up but there is nothing like sqlcommand in there? OR plz tell how to execute a query from a MS-ACCESS database? thnx Rashmi

    N 1 Reply Last reply
    0
    • D drmzunlimited

      dim str as string str= "INSERT INTO employees Values(@ID,@FN,@LN)" dim InsCom as new SqlCommand(str,SqlConnection1) plz tell me what is the error in this code. MS Visual Studio.NEt shows error in the following SqlCommand function. when i write this line dim InsCom as new sqlcommand(str,Sqlconnection1) then after new the window pops up but there is nothing like sqlcommand in there? OR plz tell how to execute a query from a MS-ACCESS database? thnx Rashmi

      N Offline
      N Offline
      notadood
      wrote on last edited by
      #2

      You need to build your sql string differently. The parameters are inside of your quote marks so the values can not be passed in. Depending on your datatypes it should look something more like: dim str as string str= "INSERT INTO employees Values(" + @ID + "," + @FN + "," + @LN + ")" dim InsCom as new SqlCommand(str,SqlConnection1) If your datatypes are int you may have to do something like str(@ID) as well as add single quotes if your datatypes are char.

      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