Click here to Skip to main content
13,793,266 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I am creating a site with asp.net web-forms. I created a SQL Server compact 4.0 local database. While trying to insert data, i get an error for the last 3days and cant fixe it. Help!!! this error said:
" There was an error parsing the query. [ Token line number = 1,Token line offset = 48,Token in error = insert ] "

HERE IS MY LINES OF CODES:¨
"
INSERT INTO login
(username, password) 
Values ('kriss', 'aspnet');

"
Posted 18-Jan-14 20:25pm
Comments
Karthik Bangalore 19-Jan-14 1:36am
   
can u post full code..
Kristian Lagaffe 19-Jan-14 1:51am
   
i having done anything much. i just begin asp.net classed and this my first assignment i am working on. After i designed the graphical UI for login, i added a new item "SQL server compact 4.0 local database". I graphically created a table called login. Then i am tryin to insert these values in the tables with 3 columns(login_ID, username,password).
Karthik Bangalore 19-Jan-14 1:55am
   
Login_ID is int autoincrement with seed (1,1) ????
Kristian Lagaffe 19-Jan-14 1:57am
   
yes, exactely
Karthik Bangalore 19-Jan-14 1:59am
   
can u pls post the schema of the table..
and also the c# code where your executing this ..
Kristian Lagaffe 19-Jan-14 2:08am
   
i haven't written any code in c# yet. i just created the local databases. i am putting this values as inbuilt in the system and the user dont need to create his own login details. So am still in the database environment under the table where i am trying to input theses values. i don't know how to send u the table schema. but i can send u a pic. if u could add me in skype: kutekriss or yahoo messenger: kutekriss81
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
Karthik Bangalore 19-Jan-14 2:20am
   
no kristian, i mean ur sql table schema of the login table..
Kristian Lagaffe 19-Jan-14 2:52am
   
JCahyaatnttearjee----- Solution didn't work!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi Kristian,
Your solution is just change the name of password field, because password is reserved word in SQL... :-)

Like-:
INSERT INTO login
(username, pswd)
Values ('kriss', 'aspnet');
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Actually the system doesn't seems to accept either "username" or "password" as field names. So i changed both. Thanks to JCahyaatnttearjee who's solution guided me.
Thanks to you all

INSERT INTO login
                         (login_username, login_pwsd)
VALUES        ('aspnet', 'site')
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.181207.3 | Last Updated 19 Jan 2014
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100