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!!Go to ADO.NET NOW !
don't be late
and you can use access in ado.net
ADO.NET
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!!
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()
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
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
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.......!!!!!!!!
Ooooh
i'm sory
about the declaration olddatareader
it should be like this
Dim Reader As OleDbDataReader = oCmd.executeReader()
0 comments:
Post a Comment