Problem in connecting DataBase through ODBC

Last post 04-23-2005 4:49 PM by Caddre. 1 replies.

Sort Posts:

  • Sad [:(] Problem in connecting DataBase through ODBC

    04-23-2005, 6:29 AM
    • Member
      322 point Member
    • adnan152
    • Member since 03-02-2004, 5:35 AM
    • Faisalabad, Pakistan
    • Posts 111

    Hii,

    I am using DBase database throught Odbc in ASP.NET. But it gives following error                                                                                         ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    Note that, I have applied same code in WindowApplication using  C#. In WindowApplication it works properly and gives no error. It gives error olny in WebApplication. I have also tried Access Database using Odbc in ASP.NET and WindowApplication. Here is also the same problem.Sad [:(]

    My code is here for binding data in DataGrid.

    void BindDg()

    {

    string conStr = "MaxBufferSize=2048;FIL=dBase 5.0;DSN=newdbase;PageTimeout=5;DefaultDir=C:\\ORIGINAL;DBQ=C:\\ORIGINAL;DriverId=533";

    OdbcConnection con = new OdbcConnection(conStr);

    string qry = "SELECT ACCOUNTNO, COMPANY, CONTACT FROM Contact1";

    OdbcCommand cmd = new OdbcCommand();

    cmd.CommandText = qry;

    cmd.Connection = con;

    OdbcDataAdapter adapter = new OdbcDataAdapter();

    adapter.SelectCommand = cmd;

    DataSet ds = new DataSet();

    adapter.Fill(ds);

    this.DataGrid1.DataSource = ds;

    this.DataGrid1.DataBind();

    }

    Adnan Sattar
    Software Engineer
    Swiftpro ltd
    Recruitment Software
  • Re: Problem in connecting DataBase through ODBC

    04-23-2005, 4:49 PM
    • All-Star
      26,551 point All-Star
    • Caddre
    • Member since 06-23-2003, 9:53 AM
    • Indy
    • Posts 5,308

    Try this url for samples with DSN.  Hope this helps.

    http://www.carlprothman.net/Default.aspx?tabid=81

    Kind regards,
    Gift Peddie
Page 1 of 1 (2 items)