Geslink 0 Denunciar post Postado Dezembro 11, 2010 Olá Galera, Estou começando, e queria uma ajudinha, se puderem. Usando o Visual Studio 2008, fiz a seguinte pagina para teste de conexão com banco MySql no UOLHOST. Se não souber responder mas se tiver algum exemplo de insersão e consulta usando o mysql no UOLHOST, agradeço. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" Width="796px"> <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /> <Columns> <asp:BoundField DataField="numero" HeaderText="numero" /> <asp:BoundField DataField="nome" HeaderText="nome" /> </Columns> <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /> <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /> </asp:GridView> </div> </form> </body> </html> Codigo VB Imports MySql.Data.MySqlClient Imports System.Data Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim con As New MySqlConnection("Server=banco ; User=usuario ; Password= senha' ; database= db") Dim da As New MySqlDataAdapter("SELECT * FROM Plan1", con) Dim dt As New DataTable da.Fill(dt) con.Close() GridView1.DataSource = dt GridView1.DataBind() End Sub End Class Até coloquei na pasta bin os arquivos MySql.Data.dll e MySql.Web.dll, que tinha adicionado como referencia. Funciona beleza na minha maquina local, porem quando subo os arquivos no server, e entro na pagina tenho a seguinte mensagem : Porque ? Server Error in '/' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off". <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration> Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL. <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration> Compartilhar este post Link para o post Compartilhar em outros sites
Daniel LM Costa 2 Denunciar post Postado Dezembro 12, 2010 Faça o que a mensagem diz, Coloque o parâmetro mode de custom errors como off.. Ele vai informar a mensagem de erro , daí post aqui o erro que realmente está ocorrendo... Compartilhar este post Link para o post Compartilhar em outros sites
Geslink 0 Denunciar post Postado Dezembro 12, 2010 Faça o que a mensagem diz, Coloque o parâmetro mode de custom errors como off.. Ele vai informar a mensagem de erro , daí post aqui o erro que realmente está ocorrendo... Consegui resolver, valeu mesmo ! Depois de arrumar o arquivo webconfig para ver o erro, vi que o erro era que a aplicação não estava carregando o arquivo dll do MySql da pasta bin. Pra resolver, coloquei a pasta bin dentro da pasta Web, que o uolHost tem. Tem que colocar tudo dentro desta bendita pasta. @#$$!8 !!! Compartilhar este post Link para o post Compartilhar em outros sites