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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:33:54+00:00 2026-05-22T01:33:54+00:00

The query does not return value when I call it from ASP C# however

  • 0

The query does not return value when I call it from ASP C# however when I connect the MySQL server and type the same query it returns right values. I couldn’t discover the problem.

Here is the code segment:

try
{
    personquery = "select b.* from booking b, makes m  "+
                  "where m.personid="+ 
                  DataDeneme1.login.personid.ToString() +
                  "and m.bookingno=b.bookingno";
    con = new MySqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("connectionString"));
    cmd.CommandText = personquery;
    con.Open();
    cmd.Connection = con;
    adap = new MySqlDataAdapter(personquery, con);
    adap.Fill(ds);
    // CheckBoxList1.DataSource = ds;
    // CheckBoxList1.DataBind();
    GridView1.DataSource = ds;
    GridView1.DataBind();
    con.Close();
}
catch (Exception ex)
{
    Response.Write(ex.Message);
    Response.Write(ex.StackTrace);
}

The input and the output from mysql server:

mysql> select b.* from booking b, makes m  where m.personid=1 and m.bookingno=b.bookingno;
+-----------+-----------------+--------------+-------------+------------+-------------+  
| bookingno | reservationdate | dropoffplace | pickupplace | pickupdate | dropoffdate |  
+-----------+-----------------+--------------+-------------+------------+-------------+  
|         8 | 2011-05-09      | Ankara       | Ankara      | 2011-05-10 | 2011-05-15  |   
|         9 | 2011-05-09      | Ankara       | Ankara      | 2011-05-20 | 2011-05-25  |   
+-----------+-----------------+--------------+-------------+------------+-------------+  
2 rows in set (0.00 sec)  

and Exception message….

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
‘m.bookingno=b.bookingno’ at line 1 at
MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at
MySql.Data.MySqlClient.NativeDriver.GetResult(Int32&
affectedRow, Int32& insertedId) at
MySql.Data.MySqlClient.Driver.GetResult(Int32
statementId, Int32& affectedRows,
Int32& insertedId) at
MySql.Data.MySqlClient.Driver.NextResult(Int32
statementId) at
MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior
behavior) at
MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior
behavior) at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior) at
System.Data.Common.DbDataAdapter.FillInternal(DataSet
dataset, DataTable[] datatables, Int32
startRecord, Int32 maxRecords, String
srcTable, IDbCommand command,
CommandBehavior behavior) at
System.Data.Common.DbDataAdapter.Fill(DataSet
dataSet, Int32 startRecord, Int32
maxRecords, String srcTable,
IDbCommand command, CommandBehavior
behavior) at
System.Data.Common.DbDataAdapter.Fill(DataSet
dataSet) at
DataDeneme1.customerview.loadList() in
E:\VisualStudioProjects\DataDeneme1\DataDeneme1\customerview.aspx.cs:line
38

  • 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-22T01:33:54+00:00Added an answer on May 22, 2026 at 1:33 am

    I would bet it has to do with the dynamic value DataDeneme1.login.personid.ToString(), since the exception states the next piece of text. Ensure your value is what you are expecting, a blank/whitespace value would cause this error.

    UPDATE
    Based on you comment I saw what I believe to be the issue. If the value is 1 then the result of this:

    personquery = "select b.* from booking b, makes m  "+
                  "where m.personid="+ 
                  DataDeneme1.login.personid.ToString() +
                  "and m.bookingno=b.bookingno";
    

    Would be:

    select b.* from booking b, makes m
    where m.personid=1and m.bookingno=b.bookingno
    

    No space, so add that to the initial query creation:

    personquery = "select b.* from booking b, makes m  "+
                  "where m.personid= "+ 
                  DataDeneme1.login.personid.ToString() +
                  " and m.bookingno=b.bookingno";
    

    Which would result in:

    select b.* from booking b, makes m
    where m.personid= 1 and m.bookingno=b.bookingno
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I make the same query twice, the second time it does not return
Why does the MySQL query below give error 1066 (Not unique table/alias: 'customer') ?
Update : Looks like the query does not throw any timeout. The connection is
I want to make sure a file path set via query string does not
This code does not throw an error but the query fails, that is, the
I want to find an SQL query to find rows where field1 does not
I am wondering why the following regex does not match. string query = \1
Say I have a linq query select r in db.Roles where r.RoleName DOES NOT
The following query does what I'd like it to do, however, I have no
This query: select * from op.tag where tag = 'fussball' Returns a result which

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.