Error into comments

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for universal data access
Post Reply
bos-s
Posts: 4
Joined: Thu 30 Sep 2010 07:18

Error into comments

Post by bos-s » Thu 30 Sep 2010 07:27

I experience a small bug with the comments into a sql script.
For instance the following script

************************
-- Selection de l 'article
-- Selection of the article
SELECT 1
************************

set the error :
Error :
Closing ' expected.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 30 Sep 2010 12:41

Could you please specify the DBMS (and its version) you are working with, and the version of dotConnect Universal you are using? In our environment, the sample worked properly with MySQL, PostgreSQL and SQL Server with the latest 3.20.22 build of dotConnect Universal.

bos-s
Posts: 4
Joined: Thu 30 Sep 2010 07:18

Post by bos-s » Thu 30 Sep 2010 13:06

I am currently working with the version 3.0.5

bos-s
Posts: 4
Joined: Thu 30 Sep 2010 07:18

Post by bos-s » Thu 30 Sep 2010 14:10

I changed to the version 3.20.22 but still experience the same problem.

If there is the ' character from a comment, the script is not executed.
If I remove it from the comment, the script is executed.

script :

-- Selection de l 'article
SELECT 1

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 01 Oct 2010 10:14

Could you please specify the following:
- the DBMS (e.g., SQL Server, MySQL or PostgreSQL) which you are connecting to;
- how exactly you are executing the script;
- whether you are receiving the error at design-time or at run-time;
- in the latter case, the exact message of the exception thrown and its stack trace.

bos-s
Posts: 4
Joined: Thu 30 Sep 2010 07:18

Post by bos-s » Fri 01 Oct 2010 12:03

OK

DMBS : SQL Server
Execution through the UniConnection provider and the script :

DataSet RunSQL(IDbConnection objConnexion, IDbCommand objCommand, IDataAdapter objAdapter, string strSubScript)
{
DataSet objDS = new DataSet();
objCommand.CommandType = CommandType.Text;
objCommand.CommandText = strSubScript;
objAdapter.Fill(objDS);
return objDS;
}

Error msg : "Closing ' expected."

Stack :

à Devart.Data.Universal.UniCommand.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3, Boolean A_4)
à Devart.Data.Universal.UniCommand.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords)
à Devart.Common.DbCommandBase.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
à Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
à Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
à System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
à System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
à System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
à System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
à RunScript.RunSQL(IDbConnection objConnexion, IDbCommand objCommand, IDataAdapter objAdapter, string strSubScript) dans C:\Dev\Code\InternalFunctions\RunScript.cs:ligne 527

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 01 Oct 2010 16:12

Thank you for the code sample. It is not recommended to use complex comments in UniCommand.CommandText, as the UniCommand class is designed for execution of single commands only. To execute complex scripts containing multiple commands and detailed comments, please use the UniScript component:
http://www.devart.com/dotconnect/univer ... cript.html

Post Reply