[RESOLVED] Error while Database name is numeric in MySQL
Hi All
I am getting error when use command
Code:
USE 12;(12 is database name)
Error is given below
Code:
Microsoft SQL-DMO (ODBC SQLState: 42000) Error: -2147221334
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '12'.
Unknown error 0x800400AA
i am using code for use database is
Code:
Qry=spSQLServer->ExecuteWithResults((_bstr_t)"USE 12",(LONG)"IF EXISTS(SELECT * FROM sysdatabases WHERE name='12'".GetLength());
Plz help me
Re: Error while Database name is numeric in MySQL
Maybe the double quote in ...name='12'".GetLength())
Re: Error while Database name is numeric in MySQL
Quote:
Originally Posted by
olivthill2
Maybe the double quote in ...name='12'".GetLength())
Thanks for reply.
is not issue.
Re: Error while Database name is numeric in MySQL
What looks strange to me is that you have "...(..."...), whereas usually, you have "...(...)..." or (..."..."...).
Re: Error while Database name is numeric in MySQL
Quote:
Originally Posted by
Msm
i am using code for use database is
Code:
Qry=spSQLServer->ExecuteWithResults( (_bstr_t)"USE 12",
(LONG)"IF EXISTS(SELECT * FROM sysdatabases WHERE name='12'".
GetLength());
What a strange call!? :confused:
1. Why does the second parameter in ExecuteWithResults mean?
2. Why are you casting char* string to LONG?
3. FYI: the ExecuteWithResults signature is (from http://msdn.microsoft.com/en-us/libr...9(SQL.90).aspx ):
Code:
HRESULT ExecuteWithResults(
SQLDMO_LPCSTR Command,
LPSQLDMOQUERYRESULTS* ppResults,
long lLength CPPDEFAULT(= 0));
Re: Error while Database name is numeric in MySQL
thanks all problem solved