Friday, November 14, 2008

C# Access Connection String live sample ASP.net

C# Access Database ConnectionString live sample ASP.net      

        string connectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=c:\\database\\xxxDB.mdb";
        OleDbConnection myOleDbConnection = new OleDbConnection(connectionString);
        OleDbCommand myOleDbCommand = myOleDbConnection.CreateCommand();
       
        string Strsql = "SELECT  top 50 * from DetailUrl where ProdType='M2'";

        myOleDbCommand.CommandText = Strsql;
        myOleDbConnection.Open();

        OleDbDataReader myOleDbDataReader = myOleDbCommand.ExecuteReader();

No comments: