Thursday, March 22, 2012

OleDbDataAdapter Configuration On Server? :(

Hi,

I am using OleDbDataAdapter to implement data grid web control and to configure the database connection i have to provide it with the provider and database name... as i am using access database so i select the provider as Jet Microsoft .... and then i have to browse for my database file and the connection gets created,

Now the problem is when i post the thing on my server it still looks for the path C:\inetpub\db\..... how can i configure that for the server. I tried to change the path in code window as ../db/... somthing like that but it didnt work ... plz help.

Thanks,
imranFor a database connection you have to use a physical path and not a relative path. To do what you are looking to acomplish you have to use "server.mappath" and the virtual path as follows:"


dim DBname as string = server.mappath("mydb.mdb")

then just plug the DBname string into your connection string
Hi,

I have used the mappath thing everywhere in my code but i dont know how to use it with the OleDbDataAdapter control as when u right click on the control it gives an option to configure the control and there i am not able to find a way to relate my access database file with server mappath .. it just lets me to browse the database file on the hard drive.
plzz suggest a way,

thanks,
imran
post the code of your page and i'll show you what to do

0 comments:

Post a Comment