none
SqlException.Number == SAException. ??? RRS feed

  • Question

  • Hi,

    I have an application build in C#.NET 2.0 for SqlServer 2005 using ADO.NET and now i want to port this code so as to use Sybase SQL Anywhere 10.0 using its iAnywhere Data Provider.

    When i was converting the code, following is the issue :

    try
    {
    // execution
    }
    catch (SqlException ex)
    {
    if(ex.Number == 241)
    {
    MessageBox.Show("Invalid date format");
    }
    }

    Now, i want to write the equivalent code. So, i wrote :

    try
    {
    // execution
    }
    catch (SAException ex)
    {
    if(ex.Number == 241)
    {
    MessageBox.Show("Invalid date format");
    }
    }

    but there is no Number property for SAException. Is there any way by which i can map the number for the error in SQL with some error number in SyBase.

    Thanks
    Kulvinder Singh
    Friday, March 28, 2008 10:30 AM

All replies

  • using sqlserver2005,copy these codes to the new query:select * from master.dbo.sysmessages,you'll find all the db err messges.good lucky,boy(girl)!


    Wednesday, May 18, 2011 9:52 AM