Opinions about ADO and ADO.NET

Hi everyone again!!!

I´m used to develope applications with ADO, but now with .NET to develope a Web Application and a Mobile Web Application, I don't know if I have to use ADO.NET or continue using ADO. What Disadvantages has ADO to built Mobile Applications?
In ADO I use ACCESS to create the .mdb files, Can I use .mdb files with ADO.NET?
Thanks for all!!
0
ernestopf
11/3/2003 9:21:28 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

7 Replies
744 Views

Similar Articles

[PageSpeed] 11

Go to ADO.NET NOW ! 

don't be late
and you can use access in ado.net
ADO.NET

VB.NET/C#/ASP.NET/Oracle Designer 6i

DotNet4Arab.com

Building a custom web control(vb.net)
0
Majed
11/3/2003 10:53:29 PM
Well, Thanks for your opinion, but I have another problem: All the information I've found is for other kind of connections, not in access. I would be very gratefull if someone could help me to create an ODBC connection to a .mdb database by ADO.NET, with a single sample on ASP.NET (VB), because I`m realy lost.

I only want to know a single sample to start developing for my own. Help Please!!!
Thanks For all and sorry for my english!!
0
ernestopf
11/4/2003 11:33:43 AM
Dim connectStr As String = "Provider=Microsoft.Jet.OleDb.4.0; datasource="C:\yourdb.mdb"

Dim oConn As New OleDbConnection(connectStr)
Dim queryStr As String = "Select * from Customers"
Dim oCmd As New OleDbCommand(queryStr, oConn)
you can then set the results of the command to an ASP control like the datagrid
For instance if you have a datagrid control datagridCustomers then
datagridCustomers.DataSource = oCmd.ExecuterReader()
datagridCustomers.DataBind()
0
NewLife
11/4/2003 12:33:24 PM
Thanks for your help!! But I need something more, I have tested your code and I get an error when I try to set the results of the comand to a datagrid. It says that ExecuteReader is not a member of System.Data.OleDb.OleDbCommand.

Here is my complete sample code:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@Page aspcompat=true Language = VB%>
<HTML>
<body>
<form runat="server" ID="Form1">
<%
Dim connectStr As String = "Provider=Microsoft.Jet.OleDb.4.0; datasource=C:\Mis documentos\PROYECTO\Dispositivos.mdb;"
Dim oConn As New OleDbConnection(connectStr)
Dim queryStr As String = "Select * from listaelementos"
Dim oCmd As New OleDbCommand(queryStr, oConn)
%>
<asp:DataGrid id="datagridCustomers" runat="server"></asp:DataGrid>
<%
datagridCustomers.DataSource = oCmd.ExecuterReader()
datagridCustomers.DataBind()
%>
</form>
</body>
</HTML>


A lot of thanks for all and sorry for my english
0
ernestopf
11/4/2003 5:21:24 PM
you not declare a datareader....

to changes in your code
1- after

Dim oCmd As New OleDbCommand(queryStr, oConn)

add

Dim Reader As New OleDataReader = oCmd.executeReader()

then

datagridCustomers.DataSource = Reader()
datagridCustomers.DataBind()

your code after edit....

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@Page aspcompat=true Language = VB%>
<HTML>
<body>
<form runat="server" ID="Form1">
<%
Dim connectStr As String = "Provider=Microsoft.Jet.OleDb.4.0; datasource=C:\Mis documentos\PROYECTO\Dispositivos.mdb;"
Dim oConn As New OleDbConnection(connectStr)
Dim queryStr As String = "Select * from listaelementos"
Dim oCmd As New OleDbCommand(queryStr, oConn)
Dim Reader As New OleDataReader = oCmd.executeReader()

%>
<asp:DataGrid id="datagridCustomers" runat="server"></asp:DataGrid>
<%
datagridCustomers.DataSource = Reader()
datagridCustomers.DataBind()
%>
</form>
</body>
</HTML>



VB.NET/C#/ASP.NET/Oracle Designer 6i

DotNet4Arab.com

Building a custom web control(vb.net)
0
Majed
11/5/2003 8:01:59 AM
Sorry but it says that it waited a instruction end on line:

Dim Reader As New OleDbDataReader = oCmd.executeReader()

Thanks!! Iknow we are near the solution, but.........!!!!!!!!
0
ernestopf
11/5/2003 4:12:54 PM
Ooooh 

i'm sory
about the declaration olddatareader
it should be like this

Dim Reader As OleDbDataReader = oCmd.executeReader()


VB.NET/C#/ASP.NET/Oracle Designer 6i

DotNet4Arab.com

Building a custom web control(vb.net)
0
Majed
11/5/2003 6:31:53 PM
Reply: