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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. syntax error executescalar

syntax error executescalar

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

    I'm getting a syntax error when debugging the code on the following line. disc1ID = CType(mycmd.ExecuteScalar(), Integer) in the below code. All the error give me to go on is syntax error. ??? Any idea what the problem could be? Private Sub NewToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripButton.Click Dim mycmd As New SqlCommand("SELECT MAX(DiscountId) AS discID FROM(Discountstructure)", MDIParent1.Conn) mycmd.CommandType = CommandType.Text Dim disc1ID As Integer MDIParent1.Conn.Open() disc1ID = CType(mycmd.ExecuteScalar(), Integer) MDIParent1.Conn.Close() MsgBox(disc1ID.ToString) End Sub

    G 1 Reply Last reply
    0
    • H Hansduncan

      I'm getting a syntax error when debugging the code on the following line. disc1ID = CType(mycmd.ExecuteScalar(), Integer) in the below code. All the error give me to go on is syntax error. ??? Any idea what the problem could be? Private Sub NewToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripButton.Click Dim mycmd As New SqlCommand("SELECT MAX(DiscountId) AS discID FROM(Discountstructure)", MDIParent1.Conn) mycmd.CommandType = CommandType.Text Dim disc1ID As Integer MDIParent1.Conn.Open() disc1ID = CType(mycmd.ExecuteScalar(), Integer) MDIParent1.Conn.Close() MsgBox(disc1ID.ToString) End Sub

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Remove the parentheses around the table name.

      --- single minded; short sighted; long gone;

      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