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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:53:27+00:00 2026-06-09T19:53:27+00:00

Inside vb.net the code below works cmd.CommandText = CREATE TABLE Notes ( num INTEGER,

  • 0

Inside vb.net the code below works

cmd.CommandText = "CREATE TABLE Notes ( num INTEGER, name TEXT)"
Try
      cmd.ExecuteNonQuery()
Catch ex As Exception
      MsgBox("Error during save operation: " & ex.Message)
End Try

cmd.CommandText = "insert into Notes(num , name ) VALUES( 3, 'Bob') "
Try
    Console.WriteLine(cmd.ExecuteNonQuery())
Catch ex As Exception
    MsgBox("Error during save operation: " & ex.Message)
End Try

But I want to put an Integer variable instead of inserting the number 3. I tried this :

Dim count As Integer = 1
cmd.CommandText = "insert into Notes(num , name ) VALUES(" + count " + , 'Bob') "

Try
     Console.WriteLine(cmd.ExecuteNonQuery())
Catch ex As Exception
      MsgBox("Error during save operation: " & ex.Message)
End Try

But then I have the exception:

Conversion from string "insert into Notes(isFirst" to type 'Double' is not valid.

I know that the line:

"insert into Notes(num , name ) VALUES(" + count + ", 'Bob') "

seems to be totally wrong but I cannot find any other solution, since I tried them all.

How can I insert the count variable into the table?

Thanks in advance.

  • 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-06-09T19:53:29+00:00Added an answer on June 9, 2026 at 7:53 pm

    You have the “+” sign on the wrong side of the double quotes:

    cmd.CommandText = "insert into Notes(num , name ) VALUES(" + count " + , 'Bob') "
    

    should be

    cmd.CommandText = "insert into Notes(num , name ) VALUES(" & count & ", 'Bob') "
    

    And as ChrisStauffer mentions, use parameters. Always.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Razor syntax in an ASP.NET MVC3 View inside a JavaScript code
I am using javascript for customValidator to validate textboxes in ASP.Net. The code works
I got a sample code from net for inserting: In the line below, should
My code is below. I also have it at http://jsfiddle.net/S2JHa/ I do not understand
What's the PDB files inside the .NET dll files and what it does? Usually
I have an XML class inside a .NET 3.5 project which is the top
in our application we have a Java applet running inside a .NET browser control.
I am trying to pass Eval to Html.RenderPartial inside ASP.NET Repeater but it does
I've got an asp.net gridview inside an updatepanel. One of the fields I have
I've got an asp.net control inside a masterpage, so I thought the following selector

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.