M
Mike
Hi I am new to csharp. I am trying to get my Csharp windows app to connect
to the sql compact database.
I am using Visual Csharp Express 2008 and I created the database using the
Csharp express IDE. It is in the project folder. I created the tables and
added elements to the table manually with the IDE. So the IDE seems to
connect to the database. I can also contact the database using the SQL
Server management studio. When I created the database I had the connection
string placed in the config.app file. A string does appear to exist there.
When I run the app. I can not seem to get a connection to the data base. I
get some kind of error29
Any idea how to write a connection string to connect to a database that is
in the project directory? I would like to do this two ways. First manually
entering the string into the connection object and second by grabbing it out
of the configuration file.
For the first method I have tried a lot of connection strings that I found
by searhing on line. I also tried copying and pasting the string out of the
config.app file.
sqlconnection conn = new sqlconnection();
conn.connectionstring = "string";
conn.open();
However, I still get the same error 29 connection problem. I would also like
to try bringing the string out of the config.app file, but I am not sure
how.
Any suggestions?
Thanks,
mike
to the sql compact database.
I am using Visual Csharp Express 2008 and I created the database using the
Csharp express IDE. It is in the project folder. I created the tables and
added elements to the table manually with the IDE. So the IDE seems to
connect to the database. I can also contact the database using the SQL
Server management studio. When I created the database I had the connection
string placed in the config.app file. A string does appear to exist there.
When I run the app. I can not seem to get a connection to the data base. I
get some kind of error29
Any idea how to write a connection string to connect to a database that is
in the project directory? I would like to do this two ways. First manually
entering the string into the connection object and second by grabbing it out
of the configuration file.
For the first method I have tried a lot of connection strings that I found
by searhing on line. I also tried copying and pasting the string out of the
config.app file.
sqlconnection conn = new sqlconnection();
conn.connectionstring = "string";
conn.open();
However, I still get the same error 29 connection problem. I would also like
to try bringing the string out of the config.app file, but I am not sure
how.
Any suggestions?
Thanks,
mike