Error SQLCE database
-
Hi everyone,
I have a problem when I want to connect to my sdf database
This is my code

I try with
db.setDatabaseName("Data Source=F:\data.sdf;Persist Security Info=False;")
But with this two case I have the same error :
QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")Do you have an idea?
Thank in advance -
Hi everyone,
I have a problem when I want to connect to my sdf database
This is my code

I try with
db.setDatabaseName("Data Source=F:\data.sdf;Persist Security Info=False;")
But with this two case I have the same error :
QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")Do you have an idea?
Thank in advance@AnthonyQt said in Error SQLCE database:
db.setDatabaseName("Data Source=F:\data.sdf;Persist Security Info=False;")Just to be sure, like your original code you do use
\\here in your code, don't you?db.setDatabaseName("Data Source=F:\\data.sdf;Persist Security Info=False;") -
@JonB said in Error SQLCE database:
s
I have the same error :/
db.setDatabaseName("Data Source=F:\\data.sdf;Persist Security Info=False;")
Give my QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")
-
@JonB said in Error SQLCE database:
s
I have the same error :/
db.setDatabaseName("Data Source=F:\\data.sdf;Persist Security Info=False;")
Give my QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")
@AnthonyQt @JonB already told you that you should use \\ instead of \ , so please change the path accordingly...
\ is escape character in C/C++. -
@JonB said in Error SQLCE database:
s
I have the same error :/
db.setDatabaseName("Data Source=F:\\data.sdf;Persist Security Info=False;")
Give my QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")
@AnthonyQt
You can see your pasted code still shows"Data Source=F:\data.sdf;Persist Security Info=False;"Meanwhile your original screenshot showed you using
"F:\\data.sdf".Please learn to use the forum's Code tags to show your code correctly, then we would know.
Is it too hard to answer my question about whether you have
\or\\in your string?UPDATE I believe you have now edited your earlier post to change. Use Code tags! Who knows....
-
@AnthonyQt
You can see your pasted code still shows"Data Source=F:\data.sdf;Persist Security Info=False;"Meanwhile your original screenshot showed you using
"F:\\data.sdf".Please learn to use the forum's Code tags to show your code correctly, then we would know.
Is it too hard to answer my question about whether you have
\or\\in your string?UPDATE I believe you have now edited your earlier post to change. Use Code tags! Who knows....
-
@AnthonyQt
Then if it works withoutPersist Security Info=False;(please verify), I can only assume that SQLCE ODBC driver does not like that parameter..... -


I made this but I have the same error
QSqlError("0", "QODBC: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")
But this give my true@AnthonyQt
But your very original post seemed to me at least to be saying you had it working with"F:\\data.sdf"but not with"Data Source=F:\\data.sdf;Persist Security Info=False;". Now it sounds like your issue has nothing to do withPersist Security Info=False;. I wish you would be clearer....Anyway, I can only guess that
Data source name not founderror message means either the syntax is wrong orF:\data.sdfdoes not exist/is not accessible. -
@AnthonyQt
But your very original post seemed to me at least to be saying you had it working with"F:\\data.sdf"but not with"Data Source=F:\\data.sdf;Persist Security Info=False;". Now it sounds like your issue has nothing to do withPersist Security Info=False;. I wish you would be clearer....Anyway, I can only guess that
Data source name not founderror message means either the syntax is wrong orF:\data.sdfdoes not exist/is not accessible.@JonB said in Error SQLCE database:
But your very original post seemed to me at least to be saying you had it working with "F:\data.sdf" but not with "Data Source=F:\data.sdf;Persist Security Info=False;". Now it sounds like your issue has nothing to do with Persist Security Info=False;. I wish you would be clearer....
No It never worked
I do this and move the database to D to see if the problem come from accessibility problem

And I have this

I don´t understand what is my error
