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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:30:13+00:00 2026-05-15T16:30:13+00:00

This is a really odd situation that I can’t seem to work out where

  • 0

This is a really odd situation that I can’t seem to work out where the problem lies.

I have a simple ASP textbox and button, on clicking the button I have a simple sqlconnection/command routine perform a simple update to a database based on the text value of the textbox.

Code:

Using myConnection As SqlConnection = New sqlConnection(ConfigurationManager.ConnectionStrings("sqldbconn").ConnectionString)
    myConnection.Open()
    Dim strSQL As String = "insert into users(name) select @name"
    Dim myCommand As New Data.SqlClient.SqlCommand(strSQL, myConnection)
    myCommand.CommandType = Data.CommandType.Text
    myCommand.Parameters.Add(create_Parameter("@name", Data.SqlDbType.VarChar, 50, Data.ParameterDirection.Input, txName.Text))
    myCommand.ExecuteNonQuery()
    myConnection.Close()
End Using

create_Parameter is just a simple tested function which performs the 2-3 lines it normally takes to create a parameter object.

The problem I have, is that the value added to the database is always a comma, followed by the text given in the textbox.

I have performed response.write’s prior to the ExecuteNonQuery call to check both the Parameter value and the CommandText, which are fine and as expected. If I copy what’s expected into a management studio query window, it works fine.. users is a simple table with varchar column, no triggers or constraints etc. There are no other sub’s in the ASP code other than what I’ve shown.

So now I’m stuck, what else can I do to work out where/why this comma is being added to my insert statement???

Cheers!

  • 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-15T16:30:14+00:00Added an answer on May 15, 2026 at 4:30 pm

    Probably nothing to do with your issue, but I wold normally write an insert like this:

    INSERT INTO users (name)
    VALUES  @name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys having this really simple problem but cant seem to figure out have
I have been having these really odd problems with Visual Studio 2010. At this
Ok, this might be a really odd problem. I am writing a web application,
This really shouldn't be hard, I just can't figure out how to do it.
I've got this really simple piece of code that I thought was the correct
I have a really odd issue with WMI that I'm running into on a
This is a really odd one. I cannot seem to affect this one image
I have a really odd problem. I am using an upload form to upload
Currently having this really odd problem with my layout IE7. I'm not very experienced
This is a really odd one that has been annoying me for some time,

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.