locked
Problem of sql query's execution RRS feed

  • Question

  • User-458598543 posted

    Hello,

    I've a problem of query's execution. This query is operational with mysql driver and since I used odbc excel driver, this query is not operational.

    The code is :

    if ((string)Session["TitreJ"] != "")
    {
    DataSourceSelectArguments args0 = new DataSourceSelectArguments();
    SqlDataSource4.SelectParameters.Clear();
    SqlDataSource4.SelectCommand = "SELECT COUNT(*) FROM [t_jp_annonce$] WHERE MATCH (T_JP_Annonce_Titre) AGAINST (? IN BOOLEAN MODE) OR idT_JP_Annonce_NumCle= ? AND STR_TO_DATE(T_JP_Annonce_fk_Cmde_DateFerm, '%Y-%c-%d %H:%i:%S') > now() AND T_JP_Annonce_Valide='VALIDE'";
    SqlDataSource4.SelectParameters.Add("@TitreA", (string)Session["TitreJ"]);

    DataView DtView1 = (DataView)SqlDataSource4.Select(args0);
    DataTable DtTable1 = DtView1.ToTable();
    SqlDataSource4.Dispose();
    return Convert.ToInt32(DtTable1.Rows[0][0].ToString());
    }

    The error's message :

    Exception Details: System.Data.Odbc.OdbcException: ERROR [07002] [Microsoft][ODBC Excel Driver]COUNT field incorrect.

    [OdbcException (0x80131937): ERROR [07002] [Microsoft][ODBC Excel Driver]COUNT field incorrect ]

    Well well, thanks for your solution !

    Rednuts72

    Thursday, February 8, 2018 3:55 PM

Answers

  • User475983607 posted

    You need Excel ODBC support. 

    My best guess is the Excel ODBC driver does not like the syntax.  Try doing a bit of fundamental troubleshooting.

    Start with a basic query and get that working.

    SELECT myfield FROM [t_jp_annonce$]

    Add to the query one bit at a time until you find what syntax causes the error.  Then lookup the proper syntax using a Google or your favorite search engine. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 8, 2018 4:16 PM

All replies

  • User475983607 posted

    You need Excel ODBC support. 

    My best guess is the Excel ODBC driver does not like the syntax.  Try doing a bit of fundamental troubleshooting.

    Start with a basic query and get that working.

    SELECT myfield FROM [t_jp_annonce$]

    Add to the query one bit at a time until you find what syntax causes the error.  Then lookup the proper syntax using a Google or your favorite search engine. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 8, 2018 4:16 PM
  • User-458598543 posted
    Hello,

    Why not support odbc connections with a standard table sheet meanwhile, there are severals databases models. Perhaps, in the future, each persons could choose his computer tool as database connector with his "volonté", work and monney.

    Well, furthermore or see you next !

    Rednuts72
    Saturday, February 17, 2018 2:19 AM