Data source and SELECT INTO

Elisa

New member
Joined
Dec 17, 2002
Messages
3
Hi Im using .NET and I cant find the correct syntax for the Data Source parameter of my connection. It is all ok when I write "Dat a Source = C:\Databases\prova.mdb" but what is the correct syntax for a virtual path? If I use "Data Source= prova.mdb" it seems not to work, even the db is in the same folder of the application.
A second question: can I use the SELECT ... INTO instruction to put some values in some application variables?
Sorry I know these are simplest questions but I am totally new ti this ... :)
 
You can use Environment.CurrentDirectory to get the current directory. Make sure your mdb is in the \bin\Debug folder and not the code folder as well and then using "Data Source=prova.mdb" should be fine

SELECT...INTO is SQL only to dynamically create a real or temp table. Youll want a regular SELECT statement and pull the value from the returned DataSet or DataReader.

-Nerseus
 
Thank you! And in this way I think I can also export the application on another pc without changing the path, right?
 
Back
Top