[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Michael

6/19/2002 9:13:00 PM

Hi,

This is a problem I've been trying to resolve for the past
3 days, so you can image my current state of mind. =:O

I'm attempting an ODBC connection to MySQL through ASP.NET
with IIS5 on my Win2k local machine. I've installed
MyODBC, MDAC2.7, and ODBC.Net in that order. Using the
data access code below I kept getting the following error:

ERROR [S1000] [TCX][MyODBC]Access denied for
user: 'localuser@localuser' (Using password: YES) ERROR
[01000] [Microsoft][ODBC Driver Manager] The driver
doesn't support the version of ODBC behavior that the
application requested (see SQLSetEnvAttr).


I then installed MyODBC 3.51 in the hopes that this would
resolve the problem, but the same error occured. I then
tried altering the access statement by using the Open
command on the and got the following error:

CS0117: 'Microsoft.Data.Odbc.OdbcConnection' does not
contain a definition for 'open'

Any help would be appreciated.


====== Data Access Code Follows ======

<%@ Page Language="C#" Debug="true" %>
<%@ Import namespace = "System.Data"%>
<%@ Import namespace = "Microsoft.Data.Odbc"%>
<%@ Assembly Name = "Microsoft.Data.Odbc" %>


<html>
<head>
<script language="C#" runat="server">
protected void Page_Load(Object sender, EventArgs e)
{
string mySQLConnStr = "driver={MySQL ODBC 3.51
Driver};";
mySQLConnStr = mySQLConnStr + "server=<localhost IP>;";
mySQLConnStr = mySQLConnStr + "uid=<local user>;";
mySQLConnStr = mySQLConnStr + "pwd=<********>;";
mySQLConnStr = mySQLConnStr + "database=myDB;";
mySQLConnStr = mySQLConnStr + "option=262144";

OdbcConnection myConnection = new OdbcConnection
(mySQLConnStr);

//alternet access for debug
//myConnection.open();

string SQL = "select * from myTable";
OdbcDataAdapter myCommand = new OdbcDataAdapter(SQL,
myConnection);

DataSet ds = new DataSet();
myCommand.Fill(ds, "myTable");
MyDataGrid.DataSource=ds.Tables["myTable"].DefaultView;
MyDataGrid.DataBind();

}
</script>

1 Answer

Geert Veenstra

6/20/2002 5:46:00 PM

0

Hi,

I have the following connection string and have no problems with MySQL :

MySQLConnectionString="driver={MySQL ODBC 3.51
Driver};server=<servername>;uid=root;pwd=;database=<databasename>;OPTION=179
23"

Maybe the option part ?

Geert

"Michael" <michael@dottedeye.com> schreef in bericht
news:ea3e01c217cd$bd623660$36ef2ecf@tkmsftngxa12...

> Hi,
>
> This is a problem I've been trying to resolve for the past
> 3 days, so you can image my current state of mind. =:O
>
> I'm attempting an ODBC connection to MySQL through ASP.NET
> with IIS5 on my Win2k local machine. I've installed
> MyODBC, MDAC2.7, and ODBC.Net in that order. Using the
> data access code below I kept getting the following error:
>
> ERROR [S1000] [TCX][MyODBC]Access denied for
> user: 'localuser@localuser' (Using password: YES) ERROR
> [01000] [Microsoft][ODBC Driver Manager] The driver
> doesn't support the version of ODBC behavior that the
> application requested (see SQLSetEnvAttr).
>
>
> I then installed MyODBC 3.51 in the hopes that this would
> resolve the problem, but the same error occured. I then
> tried altering the access statement by using the Open
> command on the and got the following error:
>
> CS0117: 'Microsoft.Data.Odbc.OdbcConnection' does not
> contain a definition for 'open'
>
> Any help would be appreciated.
>
>
> ====== Data Access Code Follows ======
>
> <%@ Page Language="C#" Debug="true" %>
> <%@ Import namespace = "System.Data"%>
> <%@ Import namespace = "Microsoft.Data.Odbc"%>
> <%@ Assembly Name = "Microsoft.Data.Odbc" %>
>
>
> <html>
> <head>
> <script language="C#" runat="server">
> protected void Page_Load(Object sender, EventArgs e)
> {
> string mySQLConnStr = "driver={MySQL ODBC 3.51
> Driver};";
> mySQLConnStr = mySQLConnStr + "server=<localhost IP>;";
> mySQLConnStr = mySQLConnStr + "uid=<local user>;";
> mySQLConnStr = mySQLConnStr + "pwd=<********>;";
> mySQLConnStr = mySQLConnStr + "database=myDB;";
> mySQLConnStr = mySQLConnStr + "option=262144";
>
> OdbcConnection myConnection = new OdbcConnection
> (mySQLConnStr);
>
> //alternet access for debug
> //myConnection.open();
>
> string SQL = "select * from myTable";
> OdbcDataAdapter myCommand = new OdbcDataAdapter(SQL,
> myConnection);
>
> DataSet ds = new DataSet();
> myCommand.Fill(ds, "myTable");
> MyDataGrid.DataSource=ds.Tables["myTable"].DefaultView;
> MyDataGrid.DataBind();
>
> }
> </script>
>