Olhem esse cod.
<%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %> <%@ Page Language="vb" Debug="true" %> <script language="vb" runat="server"> Sub Page_Load(Sender As Object, E as EventArgs) Dim objConnection As OleDbConnection Dim objCommand As OleDbDataAdapter Dim strConnect As String Dim strCommand As String Dim DataSet1 As New DataSet strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" strConnect += "Data Source=H:\WINDOWS\Microsoft.NET\Framework\" strConnect += "Samples\quickstart\aspplus\samples\grocertogo\data" strConnect += "E:\BegASPNET\Ch02\grocertogo.mdb;" strConnect += "Persist Security Info=False" strCommand = "SELECT ProductName, UnitPrice FROM products" objConnection = New OleDbConnection(strConnect) objCommand = New OleDbDataAdapter(strCommand, objConnection) objCommand.Fill(DataSet1, "Products") DataGrid1.DataSource=DataSet1.Tables("Products").DefaultView DataGrid1.DataBind() End Sub </script> <html> <head> <title>Data Grid Control example</title> </head> <body> <asp:DataGrid id="DataGrid1" runat="server" /> </body> </html>
Entao ai eu tento abrir ele e o explorer me retorna a seguinte msg
Nome de arquivo inválido. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Nome de arquivo inválido. Source Error: Line 19: objConnection = New OleDbConnection(strConnect) Line 20: objCommand = New OleDbDataAdapter(strCommand, objConnection) Line 21: objCommand.Fill(DataSet1, "Products")<<<<<------ AKE TA VERMELHO!!!!!!!!! Line 22: DataGrid1.DataSource=DataSet1.Tables("Products").DefaultView Line 23: DataGrid1.DataBind()
Mas acontece que o banco de dados tem a xxxxx da tabela products...
Nao sei mais o que eu faço!!!!! Me judem!!!!! plz!!! To comecando agora a apreendeer ASp.NET
Vlw ae !! quem me ajudar ganha um bjo da Dani... (daniela cicarelli)