[Mono-list] Bug in OdbcDataAdapter or DataSet ???
beniniva@csr.unibo.it
beniniva@csr.unibo.it
Wed, 25 Aug 2004 15:16:10 +0200
Hi,
I've an asp.net web application that shows, through an odbc connection to a
mysql database, the content of the table chosen from a DropDownList.
The code goes well on windows but on linux with mono 1.01 not all the tables
are
shown correctly.
I've also tried to run a c# example that makes the same thing and it works
well....so I think that is not a problem of mysql or odbc connection, but
rather it may be a problem of odbcDataAdapter or Data set....
Is it true?
Could anybody help me?
-------------------------
asp.net web application:
-------------------------
OdbcConnection conn = new OdbcConnection
("DRIVER=MySQL;SERVER=localhost;DATABASE=tdmio;UID=root;PASSWORD=rootpwd ;");
OdbcDataAdapter daTabella = new OdbcDataAdapter("select * from " +Tabella +
"", conn);
DataSet Ds = new DataSet();
conn.Open();
daTabella.Fill(Ds, Tabella);
conn.Close();
DataGrid1.DataSource= Ds;
DataGrid1.DataBind();
----------------------------
c# example:
----------------------------
OdbcConnection conn = new OdbcConnection
("DRIVER=MySQL;SERVER=localhost;DATABASE=tdmio;UID=root;PASSWORD=rootpwd ");
conn.Open();
OdbcCommand com = new OdbcCommand();
com = conn.CreateCommand();
com.CommandText="Select * from " +nome+ "";
OdbcDataReader dbReader =null;
dbReader = com.ExecuteReader();
Console.WriteLine();
for (int i=0; i<dbReader.FieldCount;i++)
{
Console.Write("{0}",dbReader.GetName(i).PadLeft(10,' '));
}
Console.WriteLine();
while (dbReader.Read())
{
for (int j=0;j<dbReader.FieldCount;j++)
{
Console.Write("{0}", dbReader.GetValue(j).ToString().PadRight(20,'
'));
}
Console.WriteLine();
}
dbReader.Close();
conn.Close();
---------------------
Thanks a lot,
Valentina.