Description:
Using Visual Studio 2005, I'm trying to create a dataSet using the tableAdapter
Configuration Wizard. After typing the Select Query into the Query Builder window,
clicking the Execute Query button generates a syntax error message. After checing the
syntax, I discovered that a comma is being added to the query string.
This is the query I typed (pulls data from two databases):
SELECT t1.lastname,
t1.firstname,
score,
round(score/5 * 100),
timediff(start, finish)
from database1.mdl_user t1, database2.tbl_quiz_results t2
where t1.id = t2.empid
and t2.quiz = 13
After clicking the Execute Query button, it changes the query to:
SELECT t1.lastname,
t1.firstname,
score,
round(score/5 * 100,),
timediff(start, finish)
from database1.mdl_user t1, database2.tbl_quiz_results t2
where t1.id = t2.empid
and t2.quiz = 13
There is a comma inserted in line 4, inside the parenthesis. Deleting the comma and
executing again results in the comma returning.
If I don't use the Query builder page, and just type the query into the "Enter Query"
page, the comma is not added and the query executes correctly.
How to repeat:
In a Visual Studio 2005 Website, add a new dataset.
When the TableAdapter Configuration Wizard opens, select a data connection that uses
Connector/Net (or add new connection using Connector/Net). On the Choose Command Type
page, select the "Use SQL Statements" option.
In the Enter Query page, click the Query Builder button and enter a query string similar
to my example, using a calculated field inside parenthesis.
Click the Execute Query button. This is the point at which the comma is inserted.