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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:02:14+00:00 2026-05-31T22:02:14+00:00

I have this code : String check=SELECT COUNT(*) as check FROM recordstudent WHERE STUDENT_ID=+T_STUDENT_ID+

  • 0

I have this code :

    String check="SELECT COUNT(*) as check FROM recordstudent WHERE STUDENT_ID="+T_STUDENT_ID+" AND COURSE_ID="+T_COURSE_ID+" AND PACKAGE_ID="+T_PACKAGE_ID+" AND ACTIVITY_ID="+T_ACTIVITY_ID+" AND DATE="+T_DATE+ ";";
    rs=myStmt.executeQuery(check);
    int ch=0;

    while(rs.next()){

        ch=Integer.parseInt(rs.getString("check"));
    }

    if(ch==0)
    {

        String insertRecord="insert into recordstudent"+
                "(STUDENT_ID,COURSE_ID,PACKAGE_ID,ACTIVITY_ID,TEST_NAME,DATE,SCORE,TOTAL_MARKS,PERCENTAGE,CORRECT_ANSWER,TOTAL_QUESTIONS,STUDENT_NAME,SCORE_PER_DIVISION,ATTEMPTS)"+
                "VALUES("+
                "'"+T_STUDENT_ID+"',"+
                "'"+T_COURSE_ID+"',"+
                "'"+T_PACKAGE_ID+"',"+
                "'"+T_ACTIVITY_ID+"',"+
                "'"+T_TEST_NAME+"',"+
                "'"+T_DATE+"',"+
                "'"+T_SCORE+"',"+
                "'"+T_TOTAL_MARKS+"',"+
                "'"+T_PERCENTAGE+"',"+
                "'"+T_CORRECT_ANSWERS+"',"+
                "'"+T_TOTAL_QUESTIONS+"',"+
                "'"+T_STUDENT_NAME+"',"+
                "'"+T_SCORE_PER_DIVISION+"',"+
                "'"+t+"'"
                +");";

                myStmt.execute(insertRecord);



    }

This snippet should insert the data in database only if the ch=0 .But I am getting this error:

      com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 
          You have an error in your SQL syntax; check the manual that corresponds 
          to your MySQL server version for the right syntax to use near 
          'check FROM recordstudent WHERE STUDENT_ID=11 AND COURSE_ID=2 AND PACKAGE_ID=11 A' 
          at line 1 

Can Anyone help me and solve my problem ?

  • 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-31T22:02:15+00:00Added an answer on May 31, 2026 at 10:02 pm

    check is a reserved word. Surround it with backticks: `check`

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this code that will check the array contains the specific string and
Suppose I have this code: String encoding = UTF-16; String text = [Hello StackOverflow];
So i have this code: foreach (string xmlfilelisted in xmlFileList) { resultXml.Root.Add(XDocument.Load(xmlfilelisted).Root.Elements()); resultXml.Save(filepath); }
I have this simple code public String toString() { **Iterator it = list.iterator();** String
I have this code: Dim pathString As String = HttpContext.Current.Request.MapPath(Banking.mdb) Dim odbconBanking As New
I have this code: Dim birthdaystring As String = MonthBirth.SelectedValue.ToString & / & DayBirth.SelectedValue.ToString
I have this code that makes a string and then echos the loop out
I have this code.. String you = buf.readLine(); Log.d(STRING, ikaw); StringTokenizer st = new
I have written this code to convert string in such format 0(532) 222 22
I have the following code var query = from lookup in dataset.Tables[MBDDX_LOOKUP].AsEnumerable() where lookup.Field<string>(lookup_value)

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.