RE: odbccommand cant interpret some /*xxx*/ comments



Hi Pak, tnaks for anwser, finally i found the problem, it shows up if in the
comment i use the word "select". i tried with many sql reserverd words, but
only select trigers the problem. i cant put all the code because of my
company restrictions but i give you the following info about the
scenario(weird scenario):

db server is : Adaptive Server Enterprise/12.5.4/EBF 14921
ESD#7/P/RS6000/AIX 5.1/ase1254/2095/64-bit/FBO/Fri Oct 12 12:11:32 2007

the odbc driver used is the one of SQL server 7


connection info:

OdbcConnection conn = new OdbcConnection();
StringBuilder str = new StringBuilder();

str.Append("Driver={SQL Server};");
str.Append("Server=" + ServerIP + ",");
str.Append(ServerPort + ";Network=DBMSSOCN;");
str.Append("UID=" + User + ";");
str.Append("PWD=" + Password + ";");
str.Append("Database=" + DBName + ";");

portion of code of the sp creation:

/*************************************************************************
select
*************************************************************************/

CREATE procedure spPrueba2
as
BEgIN
..
..
..
..

thaht will throw:

ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect
syntax near the keyword 'BEgIN'.

if you replace the select word in the comment with any other word, it runs
smothly.

tnks in advance for your time!


"Pak-Ming Cheung [MSFT]" wrote:

I have tested your given SProc in ODBC Test (shipped inside MDAC SDK 2.8). I
found that there is no problem if i put your given command into SQLExecDirect.

So, could you give us the exact program that can reproduce the problem?

Thanks,
Ming.
MDAC Team, Microsoft.




"Mauro SB" wrote:

Hi,
does anybody knows why can an odbccommand throw a "incorrect syntax near
begin" when i try to execute something like this:

/********************
**sp description **
********************/
create procedure spSomething
@var int
as
begin
.
.
.
end

if i split the coment it works fine, but i need the comment :D
executing from query analyzer or alikes works fine!! but not with ODBC
tnks in advance!

.



Relevant Pages

  • Re: Opinions on approach, please...
    ... Create a data layer program per table, ... number of bind variable tokens in your dynamic SQL. ... then simply EXECUTE that without passing it any parameters? ... Hard code WHERE clauses. ...
    (comp.lang.cobol)
  • Re: SQL Injection- Bypassing magic_quotes
    ... Because i was trying to execute: ... Don't terminate the query and you most ... Or try something like bobcat or one of the other SQL injection tools out ... Chief Information Security Officer ...
    (Pen-Test)
  • Re: Opinions on approach, please...
    ... Create a data layer program per table, ... number of bind variable tokens in your dynamic SQL. ... then simply EXECUTE that without passing it any parameters? ... explicitly code dummy words as bind variable placekeepers, put the host variables on the ...
    (comp.lang.cobol)
  • Re: UPDATE query in Access 2003 raising error
    ... string into a variable strSQL but create the qrydef from a string strSQLx (I ... Runtime error 3066 Query must have at least one destination field. ... The SQL works fine if I use it in the QBF Design mode. ... Elsewhere in the code I use the same technique to execute an SQL ...
    (microsoft.public.access.formscoding)
  • Re: Poor performance when executing stored procedure
    ... > Generally I would write stored procedures to do only one job. ... If SQL Server ... > which is even worse those sps can execute each other. ... > then executed spOrders which is executed in spCustomers and then got stuck ...
    (microsoft.public.sqlserver.programming)

Loading