Connect to access database on a shared folder

Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 38
Reputation: miskeen is an unknown quantity at this point 
Solved Threads: 0
miskeen miskeen is offline Offline
Light Poster

Connect to access database on a shared folder

 
0
  #1
Mar 14th, 2008
Hi,

Could you tell me please how can I open a connection to an access database located on a shared folder?

Thanks in advance,
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Connect to access database on a shared folder

 
0
  #2
Mar 17th, 2008
You can create DSN and use ODBC model in your .net application.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 38
Reputation: miskeen is an unknown quantity at this point 
Solved Threads: 0
miskeen miskeen is offline Offline
Light Poster

Re: Connect to access database on a shared folder

 
0
  #3
Mar 17th, 2008
I know how to connect to MS Access database in a local folder, but my problem is that I don't know how to do this if the database is in a shared folder.

I tried to use this connection string in a Windows application but unfortunately it failed:
  1. OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=@\\ServerName\\SharedDocs\\CS\\db1.mdb; Jet OLEDB:System Database=system.mdw;").

When I execute the program, the compiler show me that the database: C:\Documents and Settings\...\@\ServerName\SharedDocs\CS\db1.mdb is not a valid path.

Thanks for your help
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Connect to access database on a shared folder

 
0
  #4
Mar 17th, 2008
Because '\\' means relative path!! not shared path
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 9
Reputation: korssane is an unknown quantity at this point 
Solved Threads: 0
korssane korssane is offline Offline
Newbie Poster

Re: Connect to access database on a shared folder

 
0
  #5
May 22nd, 2008
Can we have access to the shared folder using the OleDb and not the OCDB.

thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Connect to access database on a shared folder

 
0
  #6
May 22nd, 2008
UNC path, browse it, I developed application runs on db in shared location.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: Connect to access database on a shared folder

 
0
  #7
May 22nd, 2008
You don't have enough back slashes in there.

If it's a UNC path like this:

\\server\sharename\file.mdb

in C# it would look like:

"\\\\server\\sharename\\file.mdb"

or @"\\server\sharename\file.mdb"

the @ symbol will make it a string literal that doesn't need to be escaped with the extra backslashes.
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 38
Reputation: miskeen is an unknown quantity at this point 
Solved Threads: 0
miskeen miskeen is offline Offline
Light Poster

Re: Connect to access database on a shared folder

 
0
  #8
Jun 18th, 2008
Hi,

Thank you all for your answers. I tried what "alc6379" recommended me and it works now.

I'm sorry; I didn't answer you before because I didn't receive any message from DaniWeb. No notification messages were sent to me and I don't know why.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 9
Reputation: korssane is an unknown quantity at this point 
Solved Threads: 0
korssane korssane is offline Offline
Newbie Poster

Re: Connect to access database on a shared folder

 
0
  #9
Aug 26th, 2008
HI guys,

i am getting error :
System.Data.Oledb.OleDbExcption : Sybtax error in INSERT INTO sataement.

here a part of my code :
public void Submit()
{
objCommandBuilder = new OleDbCommandBuilder(aAdapter);
// Obtain a new DataRow object from the table Call_Log
insertedRow = table_Call_Log.NewRow();

//CallerComboBox.SelectedItem.ToString();
// Set the DataRow field values as necessary.

insertedRow["Calling_Rep"] = "calling rep";
//insertedRow["Date_of_Call"] = DateTime.Now;

insertedRow["Unnecessary_Call"] = CheckBox1.Checked;

try
{
// Pass that new object into the Add method of the DataTable.
table_Call_Log.Rows.Add(insertedRow);

// Begin send changes to MS Access
aAdapter.UpdateCommand = objCommandBuilder.GetInsertCommand();
//aAdapter.UpdateCommand = objCommandBuilder.GetUpdateCommand();
aAdapter.Update(aDataSet,"Call_Log");

}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 9
Reputation: korssane is an unknown quantity at this point 
Solved Threads: 0
korssane korssane is offline Offline
Newbie Poster

Re: Connect to access database on a shared folder

 
0
  #10
Aug 26th, 2008
any suggestions ?
thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum


Views: 6195 | Replies: 13
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC