[RESOLVED] Error while Database name is numeric in MySQL
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: [RESOLVED] Error while Database name is numeric in MySQL

  1. #1
    Join Date
    Aug 2008
    Posts
    373

    [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

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Re: Error while Database name is numeric in MySQL

    Maybe the double quote in ...name='12'".GetLength())

  3. #3
    Join Date
    Aug 2008
    Posts
    373

    Re: Error while Database name is numeric in MySQL

    Quote Originally Posted by olivthill2 View Post
    Maybe the double quote in ...name='12'".GetLength())
    Thanks for reply.
    Code:
    Double quote
    is not issue.

  4. #4
    Join Date
    Apr 2009
    Posts
    598

    Re: Error while Database name is numeric in MySQL

    What looks strange to me is that you have "...(..."...), whereas usually, you have "...(...)..." or (..."..."...).

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: Error while Database name is numeric in MySQL

    Quote Originally Posted by Msm View Post
    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!?
    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));
    Victor Nijegorodov

  6. #6
    Join Date
    Aug 2008
    Posts
    373

    Re: Error while Database name is numeric in MySQL

    thanks all problem solved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center