Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET Espanol
|
ASP.NET Espanol Esta es una lista de correo dedicada al intercambio de conocimiento sobre ASP.NET en el idioma español.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET Espanol section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2004, 09:10 PM
Registered User
 
Join Date: Dec 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to francofm76
Default Error en codigo,libro Beginning ASPNET 1 with C#

Hola grupo
Me compré el libro "Beginning ASP.NET 1.0 with C#.NET" para aprender un poco
de asp.net combinado con C#, pero como encontré un ejemplo de codigo en la
pagina 470, donde enseña la forma de conectarse mediante AS.NET, a una BD
Access mediante OleDB, pero me da error....lo unico que modifiqué de este
ejemplo, es la ruta donde está la MDB...
Me da el siguiente error:

Server Error in '/' Application.
----------------------------------------------------------------------------
----

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS1002: ; expected

Source Error:


Line 7: strConnection += @"Data
Source=C:\inetpub\wwwroot\northwind.mdb";
Line 8: data_src.Text = strConnection;
Line 9: OleDbConnection objConnection = New OleDbConnection();
Line 10: objConnection.ConnectionString = strConnection;
Line 11:

Source File: c:\inetpub\wwwroot\oledb_connection.aspx Line: 9

Este es el codigo....alguna idea? Gracias

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script Language="c#" runat="server">
  void Page_Load()
  {
    string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
    strConnection += @"Data Source=C:\inetpub\wwwroot\northwind.mdb";
    data_src.Text = strConnection;
  OleDbConnection objConnection = New OleDbConnection();
  objConnection.ConnectionString = strConnection;


  // OleDbConnection objConnection = new OleDbConnection(strConnection);
    try
    {
      objConnection.Open();
      con_open.Text="Connection opened successfully.<br />";
      objConnection.Close();
      con_close.Text="Connection closed.<br />";
    }
    catch (Exception e)
    {
      con_open.Text="Connection failed to open.<br />";
      con_close.Text=e.ToString();
    }
  }
</script>
<html>
  <body>
  <h4>Testing the data connection
  <asp:label id="data_src" runat="server"/></h4>
  <asp:label id="con_open" runat="server"/><br />
  <asp:label id="con_close" runat="server"/><br />
  </body>
</html>
 
Old December 31st, 2004, 05:22 AM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to oÔscar
Default

Has probado a cambiarle la "barra invertida" de la ruta?
Segun quiero recordar, en C# cuando escriber una ruta, debes hacerlo al contrario de cuando la escribes en Windows o Ms-Dos; es decir
"C:/carpeta/archivo.extension".
A ver si solamente fuera esto.
Venga, un saludo, y feliz año!

 
Old April 14th, 2005, 03:55 PM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hola francofm76,
 no hablo espanol mucho , pero comprendo tu pregunta.
yo tengo mismo problema. Solucion es facil.
 Since your using c#, "New" has to be in lower case.
 new OleDbConnection

 This should solve your problem. It took me a couple of hours to figure out but i got it.

     killelmo





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASPNET account for ASPNET.MDF DB-Please help rsearing ASP.NET 2.0 Basics 13 November 6th, 2007 11:54 PM
Convert ASPNET 1.1 Project To ASPNET 2.0 [email protected] ASP.NET 2.0 Basics 3 June 29th, 2006 02:59 PM
error Login failed for user 'HOME\ASPNET' Raif General .NET 2 July 23rd, 2004 12:49 AM
Error al registrar dll hecha en vb.net en el COM+. amantona ASP.NET Espanol 0 April 13th, 2004 02:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.