I am having the hardest time connecting to this pervasive server for this asp.net application I’m working on. Right now, I am able to access and view the entire database using my connection string in the server explorer in visual studio however when I actually run it I get an error. Here is my code:
String myConnectionString =
"Driver={Pervasive ODBC Client Interface};servername=192.168.1.2;dbq=@Live;";
OdbcConnection myConnection = new OdbcConnection(myConnectionString);
OdbcCommand command = new OdbcCommand(myConnectionString, myConnection);
try
{
myConnection.Open();
OdbcDataReader reader = command.ExecuteReader();
reader.Close();
command.Dispose();
myConnection.Close();
}
catch (OdbcException ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
Here is the error I get when it runs:
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: Driver<< ??? >>={Pervasive ODBC Client Interface}
Any help would be greatly appreciated, even if it is only a wild guess as I’m kind of desperate right now.
Thanks
The line :
should have your SQL statement in it:
rather than the connection string. When you call the ExecuteReader line, the SQL engine tries to execute the connection string which is not a valid SQL statement.