126 messaggi dal 14 aprile 2006
salve, ho provato ad utilizzare il net/connector di MYSQL scaricato dal sito ufficiale versione 1.07 ma non riesco a eseguire connessioni.

volevo impostare il web.config in modo che sia definita una stringa di connessione ed un provaider 1 volta sola e poi ogni sqldataSource usi sempre quelli.

vi posto il codice del web.config


configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<connectionStrings>
<add name="ConnectionString4" connectionString="Server=localhost;Uid=myuser;Pwd=mypass;Database=mydb;" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
<system.web>
<trace enabled="true" localOnly="false"/>
<customErrors mode="Off"/>
<compilation debug="true">
<assemblies>
<add assembly="MySQLDriverCS, Version=3.0.1735.36021, Culture=neutral, PublicKeyToken=172F94DFB0FAF263"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
</compilation>
</system.web>
<system.data>
<DbProviderFactories>
<add name="MarcoMySql Data Provider" invariant="MySql.Data.MySqlClient" description="Marco MySql Provider" type="MySql.Data.MySqlClient.MySqlProviderFactory, MarcoMySql.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</DbProviderFactories>
</system.data>
<appSettings>
<add key="FCKeditor:UserFilesPath" value="~/admin/FileCaricati/" />
</appSettings>

</configuration>

ho provato anche con il Marco MySql Provider ma non funziona neanche quello.

nel sqldatasource faccio questa chiamata:

<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString4 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString4.ProviderName %>"
SelectCommand="SELECT titolo,testo,data,testo_home FROM articoli WHERE id_articolo=?" >
<SelectParameters>
<asp:QueryStringParameter QueryStringField="id" />
</SelectParameters>

</asp:SqlDataSource>
ovviamente ho le dll nella cartella bin e ho le import :

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

l'errore che mi da è il seguente se cerco di aprire una news con parametro id passato in post

Parameters must be named
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: MySql.Data.MySqlClient.MySqlException: Parameters must be named

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

questo errore se invece cerco di aprire una lista di news

Parameters must be named
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: MySql.Data.MySqlClient.MySqlException: Parameters must be named

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
l'errore dice tutto devi dare un nome ai parametri

SelectCommand="SELECT titolo,testo,data,testo_home FROM articoli WHERE id_articolo=?ID" 



<asp:QueryStringParameter QueryStringField="id" name="ID"/>



ciao marco

Chi parla senza modestia troverà difficile rendere buone le proprie parole.
Confucio

http://nostromo.spaces.live.com/default.aspx

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.