0

I'm working on VS2005 and have tried using MySQL's ODBC to connect to a database.

The problem is that when I get to the part of choosing which tables to use, there are no tables and the only selectable thing is a View, which has no name and is null (of course something like this doesn't really exist in the DB). I tried adding a Table adapter using SQL statements, which apparently works perfectly (tried also adding a Datagridview to make sure it's not a mirage and it worked perfectly) if I type the whole thing, but in the query builder it doesn't show me any tables to choose from (again if I type the name of the table, it appears but it still doesn't show it's columns). Also if I select the "Views" Tab, I get the following message:

The query builder failed

Attempt to read or write protected memory. This is often an indication that other memory is corrupt.

If it wouldn't work using the hand typed SQL statements, I may have believed it, but apparently that is not the problem. So my question is: What is going on here? Anyone has ever heard of an issue like this? And even more important: Does anyone know how to fix this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ant
  • 1,083
  • 1
  • 15
  • 35
  • Can you actually populate your datagridview with data from your database? If not, then you are probably not connecting to your database properly/successfully. There are a lot of different potential causes in this case... – Matt Ball Jul 27 '09 at 18:54
  • @Ant - BTW, why using ODBC driver if there is ADO.NET connector available (http://www.mysql.com/products/connector)? – Stanislav Jul 27 '09 at 18:58
  • @Matt Yes, it populates @Stanislav I cannot install it, it gives me an error of not being able to open svctag.xml – Ant Jul 27 '09 at 19:13
  • @Ant - like this bugs.mysql.com/bug.php?id=46257? It has a workaround http://stackoverflow.com/questions/1075679/mysql-connector-net-6-0-4-setup-failed-to-open-xml-file – Stanislav Jul 28 '09 at 04:04
  • Yap, that was it! Now it works perfectly. Only problem I encounter is when trying to add a view I get a "fatal error encountered during command execution"... – Ant Jul 28 '09 at 18:19
  • Why not to open another question? ;) – Stanislav Jul 29 '09 at 04:17
  • Done that here: (http://stackoverflow.com/questions/1200843/fatal-error-encountered-during-command-execution-when-trying-to-add-a-view-from) Thanks – Ant Jul 29 '09 at 14:53

1 Answers1

0

You should enable ODBC logging and check out the log

alt text http://img142.imageshack.us/img142/1667/20090727225415.png

And you might find useful odbctest utility http://msdn.microsoft.com/en-us/library/ms712676%28VS.85%29.aspx It is installed with MDAC or can be downloaded from http://www.datadirect.com/support/downloads/tools/index.ssp

Stanislav
  • 2,089
  • 1
  • 16
  • 11
  • So, this is a program to test the ODBC connection? And what am I supposed to do with it? – Ant Jul 28 '09 at 15:17
  • It is sometimes faster to check ODBC routines result using odbctest than to write a code. Just to keep in mind working with ODBC. – Stanislav Jul 28 '09 at 15:58