[vtkusers] vtkODBCDatabase used on an Access database file (.mdb) not working.
Donny
donnyz at charter.net
Sat Oct 30 13:38:07 EDT 2010
I am trying to access a Microsoft Access file (.mdb) using the standard
Microsoft Access ODBC Driver with vtkODBCDatabase but the query returns an
error of "Could not execute statement:".
Here is the code:
//Initialize the latitude and longitude to zero for inspection upon return
double latlon[2] = {0,0};
//This is the format for using the Microsoft Access ODBC Driver as defined
here http://www.connectionstrings.com/access#p88
//Driver={Microsoft Access Driver
(*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;
vtkODBCDatabase* db = vtkODBCDatabase::New();
db->SetDataSourceName("Driver={Microsoft Access Driver
(*.mdb)};Dbq=\"C:\\Data\\app.3dd\";Uid=Admin;Pwd=;");
vtkSQLQuery* query = db->GetQueryInstance();
query->SetQuery("Select CenterLon, CenterLat FROM Sites WHERE SiteID =
'KUEX'");
if (query->Execute())
{
while(query->NextRow())
{
latlon[0] = query->DataValue(0).ToDouble();
latlon[1] = query->DataValue(1).ToDouble();
}
}
else
{
//I get an error of Could Not Execute Statement here
const char* err = query->GetLastErrorText();
}
query->Delete();
db->Delete();
return latlon;
The program compiles fine.
I can retreive rows using the .NET OleDb driver from this database using the
exact same query so I know the tables are correct.
I would like to see if I can retreive data using VTK.
I am using Windows XP and VTK with C++ in Visual Studio 2005.
Thanks.
Donny Zimmerman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101030/5c8f7ec3/attachment.htm>
More information about the vtkusers
mailing list