OLE-DB in namespace System.Data.OleDb is not supported on Mono. OLE-DB is not
maintained. There are some old bindings internally to libgda; however, libgda
breaks backwards compatibility all the time. Going this route is a big waste
of time.
Because OleDb is part of the System.Data.dll assembly, we cannot simply remove
it.
You could try creating your own C# bindings to mdbtools. You can do an
internet search to see if someone has. But, I think this is a waste of time
too.
Maybe there is an ODBC driver to mdbtools. If there is, you can use the ODBC
functionality in Mono's System.Data.Odbc.
My suggestion would be to convert your Access database to a DBMS that Mono has
support for, such as, a SQLite database.You can use Mono's Mono.Data.Sqlite
provider or use the provider from the sqlite.org
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
There is even a fully managed C# implementation of SQLite called C#-Sqlite:
http://code.google.com/p/csharp-sqlite/
________________________________
From: Paul Johnson <[email protected]>
To: [email protected]
Sent: Saturday, October 15, 2011 12:47 PM
Subject: [Mono-list] Problem accessing an Access database in C#
Hi,
I seem to have hit a problem when try to drag data from an Access file. I know
I can do it as I've populated some combo boxes using pretty much the same code,
however, the code below is returning nothing and I cannot see why!
Any help would be appreciated
8--->
private void searchInformation(List<string> detail, List<bool> opts)
{
int id = 0;
string commandString = "Select TutorID from TutorNames WHERE Name =
'" + detail[0] + "'";
OleDbCommand objCommand = new OleDbCommand(commandString, conn);
conn.Open();
OleDbDataReader reader = objCommand.ExecuteReader();
while (reader.Read() == true)
{
try
{
id = (int)reader["TutorID"];
}
catch (Exception e)
{ }
}
conn.Close();
if (id == 0)
{
MessageBox.Show(detail[0] + " doesn't exist on the database",
"Database", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
MessageBox.Show(detail[0] + " exists, ID = " + id.ToString(),
"Database");
<---8
details[0] contains the name to be searched for (directly from a TextBox).
TutorID exists in the TutorNames table and for test purposes, I'm using data
that I know exists.
The only thing I can think of is that there are some escape characters at the
end of the text (either being passed in or in the database) - everything else
seems valid.
I have tried
"Select * from TutorNames where Name = '" + details[0] + "'" to see if I can
see TutorID, but nothing is being returned.
Additionally, I've tried another tack using a DataSet and DataTable in a
similar way to the ways shown on MSDN, but still nothing.
Any clues would be appreciated!
Thanks
Paul
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list