Add driver unit to your uses DbxMsSql
Add driver unit to your uses DbxMsSql
Hi,
I'm using C++ Builder XE, connecting to MS SQLServer 2005 using the Devart SQLServer (v 4.80.0.29) dbexpress. I'm able to successfully add SQLConnection, SQLTable.
I added a TSimpleDataSet, set the connection property to SQLconnection, set the command type to "ctTable", when I click on the command Text to select the table it throws an error
"Cannot load metadata for Microsoft SQL Server. Add driver unit to your uses (DbxInterBase or DbxDb2 or DbxMsSql or DBXMySQL or DbxOracle or DbxSybaseASA or DbxSybaseASE)."
I understand that I need to include "DbxMsSql", but not sure how to include this.
Thanks
Kasturi
I'm using C++ Builder XE, connecting to MS SQLServer 2005 using the Devart SQLServer (v 4.80.0.29) dbexpress. I'm able to successfully add SQLConnection, SQLTable.
I added a TSimpleDataSet, set the connection property to SQLconnection, set the command type to "ctTable", when I click on the command Text to select the table it throws an error
"Cannot load metadata for Microsoft SQL Server. Add driver unit to your uses (DbxInterBase or DbxDb2 or DbxMsSql or DBXMySQL or DbxOracle or DbxSybaseASA or DbxSybaseASE)."
I understand that I need to include "DbxMsSql", but not sure how to include this.
Thanks
Kasturi
Hello,
It seems that you are using the standard driver instead of our driver. Our driver doesn't require the DbxMsSql unit to be included to your project, it's the standard driver requirement. To use our driver, you should use the following settings:
It seems that you are using the standard driver instead of our driver. Our driver doesn't require the DbxMsSql unit to be included to your project, it's the standard driver requirement. To use our driver, you should use the following settings:
Code: Select all
SQLConnection.ConnectionName := 'Devart SQL Server';
SQLConnection.DriverName := 'DevartSQLServer';
SQLConnection.GetDriverFunc := 'getSQLDriverSQLServer';
SQLConnection.LibraryName := 'dbexpsda40.dll';
SQLConnection.VendorLib := 'sqloledb.dll';
Hi,
Already my SQLConnection parameters are set correctly as you have mentioned. The TSQLTable component works fine.
For the "TSimpleDataSet", I get the Add driver error when I try to select the table name from "Command Text" property.
My understanding is for TSimpleDataSet, I set the connection property to working SQLconnection, set the command type to "ctTable" and I should be able to get the list of tables in the Command Text.
Kasturi
Already my SQLConnection parameters are set correctly as you have mentioned. The TSQLTable component works fine.
For the "TSimpleDataSet", I get the Add driver error when I try to select the table name from "Command Text" property.
My understanding is for TSimpleDataSet, I set the connection property to working SQLconnection, set the command type to "ctTable" and I should be able to get the list of tables in the Command Text.
Kasturi
Please try the following:
- create a new application;
- drop the TButton component onto the form;
- include the SqlExpr, SimpleDS, and DBXDevartSQLServer units to this project in the following way: - use the following code:Please check if you encounter any problems using this project.
- create a new application;
- drop the TButton component onto the form;
- include the SqlExpr, SimpleDS, and DBXDevartSQLServer units to this project in the following way:
Code: Select all
#include "SqlExpr.hpp"
#include "SimpleDS.hpp"
#pragma link "DBXDevartSQLServer"
Code: Select all
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TSQLConnection* con = new TSQLConnection(this);
con->ConnectionName = "Devart SQL Server";
con->DriverName = "DevartSQLServer";
con->GetDriverFunc = "getSQLDriverSQLServer";
con->LibraryName = "dbexpsda40.dll";
con->VendorLib = "sqloledb.dll";
con->LoginPrompt = false;
con->Params->Values["HostName"] = "host";
con->Params->Values["Database"] = "database";
con->Params->Values["User_Name"] = "username";
con->Params->Values["Password"] = "password";
con->Open();
TSimpleDataSet* sds = new TSimpleDataSet(this);
sds->Connection = con;
sds->DataSet->CommandType = ctTable;
sds->DataSet->CommandText = "tablename";
sds->Open();
con->Close();
}
Hi,
I tried the code snippet you had mentioned. It worked but when I add the TSimpleDataSet to a form and try to select a table it shows an error, "dcldbxsda150.lib" is needed.
"dcldbxsda150.lib" is the design package and this file is not present in my machine. We're migrating from BDE to DBExpress and all our components are design time, so let me know how can I get the library files.
Thanks
I tried the code snippet you had mentioned. It worked but when I add the TSimpleDataSet to a form and try to select a table it shows an error, "dcldbxsda150.lib" is needed.
"dcldbxsda150.lib" is the design package and this file is not present in my machine. We're migrating from BDE to DBExpress and all our components are design time, so let me know how can I get the library files.
Thanks
Hi,
I had changed the ini file, I still get the popup to add the driver unit. The library file "dcldbxsda150.lib" is part of C++ Builder correct, and is not part of DEVART. If that's the case looks like I have the .bpl file but not the related .lib file in my machine. I have copied the modified ini to make sure the parameters are set correctly.
[DevartSQLServer]
GetDriverFunc=getSQLDriverSQLServer
LibraryName=dbexpsda40.dll
VendorLib=sqloledb.dll
BlobSize=-1
HostName=
DataBase=
User_Name=
Password=
ProductName=Microsoft SQL Server
DriverAssemblyLoader=Devart.DbxSda.DriverLoader.TCRDynalinkDriverLoader,Devart.DbxSda.DriverLoader,Version=1.0.0.5001,Culture=neutral,PublicKeyToken=09af7300eec23701
DriverUnit=DBXDevartSQLServer
Thanks
I had changed the ini file, I still get the popup to add the driver unit. The library file "dcldbxsda150.lib" is part of C++ Builder correct, and is not part of DEVART. If that's the case looks like I have the .bpl file but not the related .lib file in my machine. I have copied the modified ini to make sure the parameters are set correctly.
[DevartSQLServer]
GetDriverFunc=getSQLDriverSQLServer
LibraryName=dbexpsda40.dll
VendorLib=sqloledb.dll
BlobSize=-1
HostName=
DataBase=
User_Name=
Password=
ProductName=Microsoft SQL Server
DriverAssemblyLoader=Devart.DbxSda.DriverLoader.TCRDynalinkDriverLoader,Devart.DbxSda.DriverLoader,Version=1.0.0.5001,Culture=neutral,PublicKeyToken=09af7300eec23701
DriverUnit=DBXDevartSQLServer
Thanks
Please, try the following:
- remove dbExpress driver for SQL Server;
- remove all dbexpsda*.dll files from your computer;
- remove all dcu files from your project;
- reinstall dbExpress driver for SQL Server;
- change the ProductName option in the dbxdrivers.ini file to Microsoft SQL Server.
Does the error occur after performing these steps?
- remove dbExpress driver for SQL Server;
- remove all dbexpsda*.dll files from your computer;
- remove all dcu files from your project;
- reinstall dbExpress driver for SQL Server;
- change the ProductName option in the dbxdrivers.ini file to Microsoft SQL Server.
Does the error occur after performing these steps?
- I uninstalled the dbexpress drivers.
- Then I searched for dbexpsda*.dll. Did not find anything.
- Then reinstalled the dbexpress trial version.
- Then changed the product name option under the dbxdrivers.ini file to Microsoft SQL Server.
- Created a new project droped a SQLConnection and a SimpleDataSet component to the DataModule form. SQLConnection worked fine and was able to connect to the database. For SimpleDataSet, I was not able to select the table name under the Command Text property. The same error is coming.
I think the "dcldbxsda150.lib" is not available with the C++ Builder professional version and therfore I cant use it with the design time components.
- Then I searched for dbexpsda*.dll. Did not find anything.
- Then reinstalled the dbexpress trial version.
- Then changed the product name option under the dbxdrivers.ini file to Microsoft SQL Server.
- Created a new project droped a SQLConnection and a SimpleDataSet component to the DataModule form. SQLConnection worked fine and was able to connect to the database. For SimpleDataSet, I was not able to select the table name under the Command Text property. The same error is coming.
I think the "dcldbxsda150.lib" is not available with the C++ Builder professional version and therfore I cant use it with the design time components.