Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    connectionstring asp mysql

    quanto fa il prezioso questo db, non c'è modo di corteggiarlo.
    il db è Mysql in remoto con il provider register.it
    l'errore segnalato è di runtime

    nel web.config
    <connectionStrings>
    <add name="prova2" connectionString="DRIVER={MySQL ODBC 3.51 Driver};Sever=hostingmysql33.register.it; User ID=userid;Password=password; Database=eulife_eu_eulife; Option=3"/>
    </connectionStrings>

    nella page

    <%@ Page Language="VB" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %>
    <%@ Import Namespace="System.Configuration" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    If Not Page.IsPostBack Then
    Dim MyReader As SqlDataReader

    Dim MyConnection As SqlConnection = New SqlConnection()
    MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("prova2").C onnectionString

    Dim MyCommand As SqlCommand = New SqlCommand()
    MyCommand.CommandText = "SELECT * FROM clienti"
    MyCommand.CommandType = CommandType.Text
    MyCommand.Connection = MyConnection

    MyCommand.Connection.Open()
    MyReader = MyCommand.ExecuteReader(CommandBehavior.CloseConne ction)

    cli.DataSource = MyReader
    cli.DataBind()

    MyCommand.Dispose()
    MyConnection.Dispose()

    End If
    End Sub

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>xxxxxxxx</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    ppp

    <asp:GridView ID="cli" runat="server" DataSourceID="SqlDataSource1">
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>
    </div>
    </form>
    </body>
    </html>

  2. #2
    guest.1
    Guest
    ciao, te lo posto in c#
    e vedi se ti torna.

    default.aspx
    codice:
    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
    <%@ Import Namespace="System.Data.Odbc" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Configuration" %>
    <script runat="server">
        String connectionString = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
        protected void Page_Load(object sender, EventArgs e)
        {
           
    
            popola();
            
        }
    
        private void popola()
        {
    
            OdbcConnection conn = new OdbcConnection(connectionString);
            string SQL = "SELECT * FROM news WHERE _status='1';";
            OdbcCommand objCommand = new OdbcCommand(SQL, conn);
            DataSet ds = new DataSet();
            OdbcDataAdapter da = new OdbcDataAdapter(objCommand);
            da.Fill(ds);
            MyGrid.DataSource = ds;
            MyGrid.DataBind();
        
     
    
        }
    
        protected void MyGrid_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
             MyGrid.PageIndex = e.NewPageIndex;
            popola();
        }
    </script>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
        <style type="text/css">
            .style1
            {
                width: 100%;
            }
        </style>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Label ID="lblMsg" runat="server"></asp:Label>
    
    <div class="post"><h2>Sponsor</h2>
        <table class="style1">
            <tr>
                <td>
                    [img]sponsor/atsilvia.gif[/img]</td>
                <td>
                    [img]sponsor/bizzok.gif[/img]</td>
                <td>
                    [img]sponsor/lella.gif[/img]</td>
            </tr>
        </table><h2>News</h2>
     <asp:GridView ID="MyGrid" runat="server" GridLines="None"   EmptyDataText="Non ci sono dati"
        AllowPaging="true" PageSize="1" AutoGenerateColumns="false"  Width="100%"  BorderStyle="None" 
        ShowHeader="false" ShowFooter="true"
            onpageindexchanging="MyGrid_PageIndexChanging"    >
            <Columns>
            
            <asp:TemplateField>
            <ItemTemplate>
            <h1 class="title"><%# Eval("_subject") %></h1>
            <%# Eval("_contentHome")%>
            <p align="right">Scritta da :<%# Eval("_name") %></p>
           <div class="meta">
    				<p class="links">" class="more">Leggi tutto&raquo;</p>
    				</div>
            </ItemTemplate>
            <FooterTemplate>
            		  </FooterTemplate>
            </asp:TemplateField>
            
            </Columns>
        </asp:GridView>
       </div>
    </asp:Content>
    e il file web.config
    codice:
    	<connectionStrings>
        <add name="ConnStr" connectionString="Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Uid=tuauser; Pwd=tuapwd; Database=tuodatabase;" />
      </connectionStrings>
    ciao. vedi se ti funziona ovviamente mettendo i tuoi campi.

  3. #3
    innanzitutto mille grazie della risposta e per avermi fatto scoprire che non avevo inserito l'import odbc

    <%@ Import Namespace="System.Data.Odbc" %>

    ho reimpostato la page in c# con i miei dati ma l'errore non è cambiato. lo posto:

    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".



    <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.



    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>

  4. #4
    guest.1
    Guest
    non lo so ,
    ma mi sembra che dice che devi inserire nel web.config queste righe:

    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>

    e vedi se ti va.

    Quel messaggio viene fuori quando c'è un errore e non lo può mostrare,
    quindi di dice di inserire quelle righe.

    L'unico che devi installare mysql odbc driver. se non lo hai fatto.

    http://dev.mysql.com/downloads/connector/odbc/3.51.html

    poi non lo so .

  5. #5
    si avevo installato i driver ma niente da fare,,

    continuerò a provare e cercare, prima o poi troverà l'arcano

    grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.