?
Solved

MySql.Data.MySqlClient.MySqlException: Table 'someTable' doesn't exist - but it does

Posted on 2006-05-31
2
Medium Priority
?
1,239 Views
Last Modified: 2008-02-01
Hello,
I have a vb.net program that that wants to query a MySql DB to get information. It seems to connect but I get the error in the title
which says the table does not exist. Any suggestions on why this is happening and how to get around it? Below is the code and error.
Thanks in advance. Joe

Dim oString As String
Dim intNumSpecials As Integer
Dim dsConn As New MySql.Data.MySqlClient.MySqlConnection()
Dim myConnectionString As String

myConnectionString = "server=someserver;uid=someuname;pwd=somepasswd;database=someDB"
dsConn.ConnectionString = myConnectionString
dsConn.Open()
oString = "SELECT count(f1) " _
            & "FROM t1" _
            & "WHERE f2= " & ID
Dim cmd As MySqlCommand = New MySqlCommand()
cmd.CommandText = oString
cmd.Connection = dsConn
intNumSpecials = cmd.ExecuteScalar()


MySql.Data.MySqlClient.MySqlException: Table 'DB.T1' doesn't exist at MySql.Data.MySqlClient.PacketReader.CheckForError() at MySql.Data.MySqlClient.PacketReader.ReadHeader() at MySql.Data.MySqlClient.PacketReader.OpenPacket() at MySql.Data.MySqlClient.NativeDriver.ReadResult(Int64& affectedRows, Int64& lastInsertId) at MySql.Data.MySqlClient.CommandResult.ReadNextResult(Boolean isFirst) at MySql.Data.MySqlClient.CommandResult..ctor(Driver d, Boolean isBinary) at MySql.Data.MySqlClient.NativeDriver.SendQuery(Byte[] bytes, Int32 length, Boolean consume) at MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySqlDataReader reader) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader() at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar() at Namespace.Class.Function(Object ID) at Namespace.Class.Bindata(String strAddSearch, String strOrderby)
0
Comment
Question by:CJSantora
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 16799015
Try this (with extra spaces):

oString = "SELECT count(f1) " _
            & " FROM t1" _
            & " WHERE f2= " & ID

Bob
0
 

Author Comment

by:CJSantora
ID: 16799567
It turns out that the issue was the table name in the MySql database was all capital letters but my query
had only the first letter Capitalized. Thanks for the help.
Joe
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question