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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:01:34+00:00 2026-05-28T08:01:34+00:00

I am having trouble inserting values into my Account table that’s in a SQL

  • 0

I am having trouble inserting values into my Account table that’s in a SQL Server Compact Edition database. I keep on getting an error that states

There was an error parsing the query. [Token line number=1, Token
line offset =62, Token in error = s].

This seems to be a common error with SQL Server CE, but everything I have tried doesn’t seem to work. Here is the code:

Public Sub addPlan(ByVal planname As String, ByVal plannumber As String)

    Dim strSql As String = (String.Format("INSERT INTO [Account] (plan_name, plan_number) VALUES (N'{0},N'{1})", Trim(planname), Trim(plannumber)))

    Try

        Using cmdAdd As New SqlCeCommand(strSql, conn)
            cmdAdd.ExecuteNonQuery()
        End Using

    Catch ex As Exception
        MessageBox.Show(ex.ToString)

    Finally
        displayPlandt()
    End Try

End Sub

Public Sub displayPlandt()

    Dim strSql As String = "SELECT * From Account"

    Using dtadapter As New SqlCeDataAdapter(strSql, conn)

        Dim dt As New DataTable
        dtadapter.Fill(dt)
        Form1.dgridplanview.DataSource = dt

    End Using

End Sub

Another question that I have is how I am updating the datatable on the form. I call this method in the finally portion of my try statement. However, I am re-querying the database and refilling the whole datatable every time I need to refresh it. Is there a way to do the same thing without refilling the whole datatable?

Thanks!

  • 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-28T08:01:35+00:00Added an answer on May 28, 2026 at 8:01 am

    i think you miss end quotes.

    Try this

    Dim strSql As String = (String.Format("INSERT INTO [Account] (plan_name, plan_number) VALUES (N'{0}',N'{1}')", Trim(planname), Trim(plannumber)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble inserting an array into the sql database. my error
I'm having trouble working this out for inserting input values into database. I have
Having trouble inserting new records into a table. Anybody care to help? <?php include('config.php');
I'm having a bit of trouble inserting into a sqlite3 database with pdo. You'll
I am having trouble inserting a record into a MySQL database from python. This
I'm having trouble inserting data into a table. I have the following tables: track
I'm having trouble inserting char* into a vector< char*> When I do the following:
I'm having some trouble scaling an image that i am inserting. I must be
I'm having trouble inserting data from my registration webform into sqlserver-2008. I'm getting an
i am having trouble inserting objects of type pair<int, int> into a queue. i

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.