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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:47:18+00:00 2026-05-31T03:47:18+00:00

Hi following Code gives a Syntax Error.I don’t know how to fix the Problem.

  • 0

Hi following Code gives a Syntax Error.I don’t know how to fix the Problem.

The Error

{“SQLite error\r\nnear \”Mytext\”: syntax error”}

My Code

string dataSource = "Database.s3db";
SQLiteConnection connection = new SQLiteConnection();
connection.ConnectionString = "Data Source=" + dataSource;
connection.Open();
SQLiteCommand command = new SQLiteCommand(connection);
command.CommandText = ("update Example set Info ='" + textBox2.Text + ", Text ='"+textBox3.Text + "where ID ='" + textBox1.Text +"'");
command.ExecuteNonQuery();
  • 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-31T03:47:20+00:00Added an answer on May 31, 2026 at 3:47 am

    Others have suggested alternative ways of constructing the SQL, but you shouldn’t be including the values in the SQL at all. You should be using a parameterized query, which avoids SQL injection attacks amongst other things.

    It’s not immediately clear to me which driver you’re using, but assuming it’s the Devart.com one, the documentation for SQLiteCommand.Parameters gives a good example of how to do this. In your case, the code would become something like:

    string dataSource = "Database.s3db";
    using (SQLiteConnection connection = new SQLiteConnection())
    {
        connection.ConnectionString = "Data Source=" + dataSource;
        connection.Open();
        using (SQLiteCommand command = new SQLiteCommand(connection))
        {
            command.CommandText =
                "update Example set Info = :info, Text = :text where ID=:id";
            command.Parameters.Add("info", DbType.String).Value = textBox2.Text; 
            command.Parameters.Add("text", DbType.String).Value = textBox3.Text; 
            command.Parameters.Add("id", DbType.String).Value = textBox1.Text; 
            command.ExecuteNonQuery();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code gives me an error: syntax error before: Some_ets -module(tut). -export([incr/1]). Some_ets
Hello i got a problem with my mysql code it gives the following error
In C++ the following code gives a compiler error: void destruct1 (int * item)
The following code in javascript gives me the error this.callback is not a function
Using the following code I get a nice formatted string: Request.QueryString.ToString Gives me something
In the following code, g++ gives this error : 1.cpp: In member function void
I'm using the following code but it gives me an error about an unexpeted
I have the following code which gives me an error. I want to add
The following code gives a segmentation fault on the last line require 'rubygems' gem
The following code gives a NullReferenceException since XPathSelectElement can't navigate through the XPath expression

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.