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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:55:55+00:00 2026-05-27T14:55:55+00:00

i have one database problem, if my sql is like this: Dim Username Username

  • 0

i have one database problem, if my sql is like this:

Dim Username
Username = request.form(trim("username"))
Username = Replace(username,"'","''") 

Dim email
email = request.form(trim("email"))
email = Replace(email,"'","''")

Dim question
question = request.form(trim("question"))
question = Replace(question,"'","''")

Dim answer
answer = request.form(trim("answer"))
answer = Replace(answer,"'","''")


Dim date_answered
dag = Day(Now())
maand = Month(Now())
jaar = Year(Now())
uur = Hour(Time)
minuten = Minute(Time)
seconden = Second(Time)
datum= jaar & "-" & maand & "-" & dag
tijd = uur & ":" & minuten& ":" & seconden
date_answered = (datum & " " & tijd)

Dim isActive
isActive = "yes"    
sql="UPDATE faqtbl SET "
      sql=sql & "Name='" & username & "',"
      sql=sql & "email='" & email & "',"
      sql=sql & "question='" & question & "',"
      sql=sql & "answer='" & answer & "',"
      sql=sql & "date_answered='" & date_answered & "',"
      sql=sql & "isActive='" & isActive & "'"
      sql=sql & " WHERE ID='" & lngRecordNo &"';"
      on error resume next

there is no problem at all until if the data that i want to add into the database is using double quotes.
please help how do i manipulate the query by using double quotes?
thank you.. 🙂

  • 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-27T14:55:55+00:00Added an answer on May 27, 2026 at 2:55 pm

    There is a problem in your code even if the data does not use quotes: your dynamically generated SQL statements are wide-open to SQL interjection attacks. You need to re-write your query to use query parameters. This will address the problem with the quotes, and make your SQL a lot more robust.

    Here is a short example of how to modify your update to use parameters:

    Imports System.Data.SqlClient
    Public Class Example
        Private Sub Update(ByVal userName As System.String, _
                ByVal email As System.String)
            Dim con As SqlConnection = New SqlConnection( _
                "Data Source=.;Integrated Security=True;<...>")
            con.Open()
            Dim cmdText As String = _
                "UPDATE faqtbl SET Name=@UserName,Email=@email"
            Dim cmd As SqlCommand = New SqlCommand(cmdText, con)
            With cmd.Parameters
                .Add(New SqlParameter("@UserName", userName))
                .Add(New SqlParameter("@email", email))
            End With
            cmd.ExecuteNonQuery()
            con.Close()
            con = Nothing
        End Sub
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If i have SQL Server tables like this: Location ---------- LocationId int PK Field1
I have one database table which contains 8 columns. One of the columns is
i have one database, and it contains some columns. My requirement is that how
In StackOverflow podcast no. 19 , Joe describe Fogcreek's decision to have one database
I have two database one with relationship(no data) and another with out Relationship (with
i have one php file which process adding of record in Database fro array.
I have a list of e-mails from one database which I want to check
I have SMO code which copies tables from one database to another. It runs
i have a process to move rows from one database to another. Because of
Say you have 2 database servers, one database is the 'master' database where all

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.