.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

problem getting data from Access

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :ASP.Net

What is the problem with this code?

DataTable dt = new DataTable();
        dt.Columns.Add("EventID", Type.GetType("System.String"));
        dt.Columns.Add("EventEnd", Type.GetType("System.String"));

        string connectionString = "provider = Microsoft.Jet.OLEDB.4.0;" + "data source =" + Page.Server.MapPath("App_Data\\database.mdb");

        System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connectionString);

        System.Data.OleDb.OleDbCommand cmd = conn.CreateCommand();

        cmd.CommandText = "SELECT * FROM [event]";


        System.Data.OleDb.OleDbDataReader dr = cmd.ExecuteReader();

        DataRow dro;

        dro = dt.NewRow();
        dro["EventId"] = dr["EventID"].ToString(); 
        dro["EventStart"] = dr["EventStart"].ToString();
        dro["EventEnd"] = d

View Complete Post

More Related Resource Links

Problem with connectionstring in data access layer



I am developing a web application in Visualt Studio 2008. I have a data access layer that is automatically generated using Visual Studio. After publising my site to IIS and tested it for several hours, two exceptions occured:

Not allowed to change the 'ConnectionString' property. The connection's current state is connecting.	   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value)     at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)     at C2T.DataAccess.UsersDataSetTableAdapters.UsersTableAdapter.InitConnection() in C:\sejanhe\Click2Track\C2T.NET\C2T.DataAccess\UsersDataSet.Designer.cs:line 1378     at C2T.DataAccess.UsersDataSetTableAdapters.UsersTableAdapter.get_Connection() in C:\sejanhe\Click2Track\C2T.NET\C2T.DataAccess\UsersDataSet.Designer.cs:line 1159     at C2T.DataAccess.UsersDataSetTableAdapters.UsersTableAdapter.InitAdapter() in C:\sejanhe\Click2Track\C2T.NET\C2T.DataAccess\UsersDataSet.Designer.cs:line 1251     at C2T.DataAccess.UsersDataSetTableAdapters.UsersTableAdapter.get_Adapter() in C:\sejanhe\Click2Track\C2T.NET\C2T.DataAccess\UsersDataSet.Designer.cs:line 1149     at C2T.DataAccess.UsersDataSetTableAdapters.UsersTableAdapter.FillByUserNamePasswordAndStatus(UsersDataTable dataTable, String Usr_Names, String Usr_Pwd, Nullable`1 Usr_Status) in C:\

Problem with vs 10 C# data access


I developed an application using C# and SQL EXPRESS 2008 on a windows 2003 server and it works fine

but after that in another PC which has windows 7 I installed SQL SERVER MANAGEMENT STUDIO and tried to access the database which was on the 2003 server then the database was accessible

I used the following on SQL MANAGEMENT STUDIO

Server Type : Database Engine

Server name : xxx.xxx.xxx.xxx\SQLEXPRESS

Authentication :

     Login : sa

     Password: <BLANK>


bt when I develop an application in that client PC and tried to access SQL SERVER EXPRESS using C# it din work it states that a



A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)



 SqlConnection cn = new
 SqlConnection("user id=sa;"

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

MySql.Data assembly problem



I added refernece MySql.Data to my project. My web.config looks like that:

<?xml version="1.0"?>
                <add assembly="MySql.Data, Version=, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>

But when in ServerExplorer I try "Add Connection..." I can't find "MySql Database" in the "Choose Data Source" dialog box?

What the problem can be?

Microsoft Application Block for Data Access in .NET


Hi all,

I was rummaging the internet learning aspx and came across the concept of: Microsoft Application Block for Data Access in .NET

It seems great of course. The articles are all early 2003-5 such as


So the question is - is this tech still relevant and should I be using it?



data access library v4.1


Ive just started a project that will use the enterprise library 4.1 data access code blocks.  Its been years since ive used them, can anyone tell me what assemblies I need to reference in my project in order to use them ?  Ive referenced 


are there any others I need ?

Data Points: Deny Table Access to the Entity Framework Without Causing a Mutiny


Julie Lerman shows database administrators how to limit access to databases from the Entity Framework by allowing it to work only with views and stored procedures instead of tables-without impacting application code or alienating developers.

Julie Lerman

MSDN Magazine August 2010

Data Access: Building a Desktop To-Do Application with NHibernate


Building an NHibernate-based desktop application isn't any harder than building a web application, and in many cases NHibernate simplifies elements of session handling and concurrency.

Oren Eini

MSDN Magazine December 2009

EF Data Access: EF v2 and Data Access Architecture Best Practices


Developers deploy a wide variety of development philosophies and architecture styles. This article explores three common perspectives on application development and describes how the Entity Framework can be employed in each. Specifically, the article looks at the forms-centric, model-centric, and code-centric development styles and their relationship to the Entity Framework.

Tim Mallalieu

MSDN Magazine August 2009

Under the Table: How Data Access Code Affects Database Performance


In this article, the author delves into some commonly used ways of writing data access code and looks at the effect they can have on performance.

Bob Beauchemin

MSDN Magazine August 2009

Data Services: Access Your Data On Premise Or In The Cloud With ADO.NET Data Services


In this article the author looks at two versions of the same application--one consuming an on-premise Data Service, and one consuming an Azure Table Data Service to illustrate data access in the cloud.

Elisa Flasko

MSDN Magazine May 2009

SOA Data Access: Flexible Data Access With LINQ To SQL And The Entity Framework


Building a data access layer using LINQ to SQL and the ADO.NET Entity Framework allows you to decouple your application from the persistence technology you're using.

Anthony Sneed

MSDN Magazine December 2008

Data Points: The Enterprise Library Data Access Application Block, Part 3


E nterprise applications can have a wide variety of data update requirements. Sometimes you need to save multiple rows of changes at once within a single transaction. Other times, the user must be allowed to enter multiple rows of data, send them to the database in a batch; and if a row or two fails, only the rows that succeeded should be committed and remain committed.

John Papa

MSDN Magazine October 2005

Data Points: The Enterprise Library Data Access Application Block, Part 2


Last month I explored the foundation of the Enterprise Library Data Access Application Block (DAAB) including how it all fits into an architecture (see Data Points: The Enterprise Library Data Access Application Block, Part 1).

John Papa

MSDN Magazine August 2005

Data Points: The Enterprise Library Data Access Application Block, Part 1


A solid data access later (DAL) can benefit an application by hiding redundant tasks, helping handle exceptions more gracefully, helping clean up resources more efficiently, and providing a layer of abstraction from the database.

John Papa

MSDN Magazine July 2005

Data Points: Data Access Strategies Using ADO.NET and SQL


When your goal is a scalable and efficient enterprise solution, you need to develop an efficient data-access strategy. You can't just do some testing on your production machines and rely on the results.

John Papa

MSDN Magazine May 2005

Data Access: Implement a Data Access Layer for Your App with ADO.NET


Implementing data access functionality is a core activity of most developers working with the .NET Framework, and the data access layers they build are an essential part of their applications. This article outlines five ideas to consider when building a data access layer with Visual Studio .NET and the .NET Framework. The tips include taking advantage of object-oriented techniques and the .NET Framework infrastructure by using base classes, making classes easily inheritable by following guidelines, and carefully examining your needs before deciding on a presentation method and external interface.

Dan Fox

MSDN Magazine April 2003

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend