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

  • Home
  • SEARCH
  • 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 9253295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:11:02+00:00 2026-06-18T11:11:02+00:00

Here is the SQL statement: SQL = INSERT INTO MYIMAGES(image_blob, filename, description, filesize, accountnum,

  • 0

Here is the SQL statement:

SQL = "INSERT INTO MYIMAGES(image_blob, filename, description, filesize, accountnum, rmanum, billol, copiedfilename) VALUES(?, '"
SQL = SQL & File.Filename & "', '"
SQL = SQL & Replace(Upload.Form("DESCR"), "'", "''") & "', '"
SQL = SQL & File.Size & "', '"
SQL = SQL & Replace(Upload.Form("accountnum"), "'", "''") & "', '"
SQL = SQL & Replace(Upload.Form("rmanum"), "'", "''") & "', '"
SQL = SQL & Replace(Upload.Form("billol"), "'", "''") & "', "
SQL = SQL & Replace(Upload.Form("accountnum"), "'", "''") & "-" & Replace(Upload.Form("rmanum"), "'", "''") & ")"

accountnum = 3456345 rmanum = 345234

The value in the database that gets entered is 3111111 what I want it to be is 3456345-345234

The data type of the column is varchar(255) – what am I doing wrong??

  • 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-18T11:11:03+00:00Added an answer on June 18, 2026 at 11:11 am

    If you use sql parameters you can avoid REPLACE and also any sql injections

    Ex:

    Change sql statement to

    INSERT INTO MYIMAGES(image_blob, filename, description, filesize, 
       accountnum, rmanum, billol, copiedfilename) 
    VALUES(@p1, @p2, @p3,@p4,@p5, @p6, @p7,@p8)
    

    Then do

    cmd.Parameters.AddWithValue("@p2",File.Filename)
    cmd.Parameters.AddWithValue("@p3",Upload.Form("DESCR"))
    

    ….

    //this will insert correct data
    cmd.Parameters.AddWithValue("@p8",Upload.Form("accountnum") & "-" & 
                                      Upload.Form("rmanum"))
    

    Updated based on OP comment:
    For ASP try this

    dim cmd, rs, param1, param2, param3, param4, param5,param6, param7, param8
    set cmd = server.CreateObject("adodb.command")
    strCmd = "INSERT INTO MYIMAGES(image_blob, filename, description, 
                filesize, accountnum, rmanum, billol, copiedfilename)
                VALUES(?,?,?,?,?,?,?,?)"
    Set cmd.ActiveConnection = objConn
    cmd.CommandText = strCmd
    cmd.CommandType = adCmdText
    Set param1 = cmd.CreateParameter ("image_blob", adWChar, adParamInput, 50)
    param1.value = image_blob
    cmd.Parameters.Append param1
    ....
    Set param8 = cmd.CreateParameter ("copiedfilename", adWChar, adParamInput, 50)
    param8.value = Upload.Form("accountnum") & "-" & Upload.Form("rmanum")
    cmd.Parameters.Append param8
    Set rs = cmd.Execute()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to run this sql statement: INSERT INTO JSP_CONTROL (estado,hora_inicio,fecha,tipo) VALUES ('ACTUALIZANDO',to_char(sysdate, 'HH24:mi:SS'),sysdate,'uno');
Hi there here is my SQL insert statement: $customeraddress_query = INSERT INTO `customer_address` (
Here's my SQL statement: protected static $_SQLInsert = INSERT INTO location (host_id, street, suburb,
I am concatenating different values and I get the following sql statement: INSERT INTO
I have the following INSERT statement: INSERT INTO [StoreTestDB].[dbo].[KitItem] ([KitItemGUID] ,[KitGroupID] ,[Name] ,[Description] ,[PriceDelta]
In the comments on this answer , Remou writes that CurrentDB.Execute insert sql here
Here is a SQL query which fail if multiple values are returned by first-
I'm trying to use an SQL insert statement to migrate rows from a table
Using SQL Server. I am getting an error from an SQL Insert statement: The
I'm trying to combine an insert sql statement with a select statement, I successfully

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.