Link to home
Start Free TrialLog in
Avatar of CJSantora
CJSantora

asked on

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

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)
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CJSantora
CJSantora

ASKER

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