473,324 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

C# connection and file access question

Hi,

In C# the SqlConnection=
"data source=192.168.100.100;uid=MyID;password=MyPwd;dat abase=ETCserviceTest
";
and it is for SQL data connection.
Do we have some similiar method for accessing files in a paticular Windows
XP machine?
Thanks for help.
Jason
Mar 15 '06 #1
3 1830
The windows file system allows file sharing under the control of the
machine's owner. Windows XP does not normally allow external access to the
files on that machine.

However, file sharing is enabled, and if you have permissions to the machine
(in other words, if you are listed in the Local Users or Local
Administrators group on that machine) then you can access files on the C
drive as:
"\\MachineName\C$\mydirectory\myfile" using normal methods for opening,
reading, and writing files (instead of SQL connect strings).

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP14.phx.gbl...
Hi,

In C# the SqlConnection=
"data
source=192.168.100.100;uid=MyID;password=MyPwd;dat abase=ETCserviceTest ";
and it is for SQL data connection.
Do we have some similiar method for accessing files in a paticular Windows
XP machine?
Thanks for help.
Jason

Mar 15 '06 #2
Thanks Nick.
But is it possible for using the C# code to get into the Windows XP folders
and access the files? given that we know the Account and Password?
Thanks for help.
Jason

"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com> ¼¶¼g©ó¶l¥ó·s»D:jY******************************@co mcast.com...
The windows file system allows file sharing under the control of the
machine's owner. Windows XP does not normally allow external access to
the files on that machine.

However, file sharing is enabled, and if you have permissions to the
machine (in other words, if you are listed in the Local Users or Local
Administrators group on that machine) then you can access files on the C
drive as:
"\\MachineName\C$\mydirectory\myfile" using normal methods for opening,
reading, and writing files (instead of SQL connect strings).

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP14.phx.gbl...
Hi,

In C# the SqlConnection=
"data
source=192.168.100.100;uid=MyID;password=MyPwd;dat abase=ETCserviceTest ";
and it is for SQL data connection.
Do we have some similiar method for accessing files in a paticular
Windows XP machine?
Thanks for help.
Jason


Mar 15 '06 #3
Yes, assuming that the machine you are accessing the files FROM is on the
same domain as the machine with the files. If this is so, then impersonate
the user that has permissions, and simply open the file using the UNC
notation in the prior response.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
Thanks Nick.
But is it possible for using the C# code to get into the Windows XP
folders and access the files? given that we know the Account and
Password?
Thanks for help.
Jason

"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com>
¼¶¼g©ó¶l¥ó·s»D:jY******************************@co mcast.com...
The windows file system allows file sharing under the control of the
machine's owner. Windows XP does not normally allow external access to
the files on that machine.

However, file sharing is enabled, and if you have permissions to the
machine (in other words, if you are listed in the Local Users or Local
Administrators group on that machine) then you can access files on the C
drive as:
"\\MachineName\C$\mydirectory\myfile" using normal methods for opening,
reading, and writing files (instead of SQL connect strings).

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP14.phx.gbl...
Hi,

In C# the SqlConnection=
"data
source=192.168.100.100;uid=MyID;password=MyPwd;dat abase=ETCserviceTest
";
and it is for SQL data connection.
Do we have some similiar method for accessing files in a paticular
Windows XP machine?
Thanks for help.
Jason



Mar 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
5
by: Alec | last post by:
Hi All, I am currently trying to link in Access 97 to a table in a MSSQL 7 server. Initially the link is fine, however, when I close the access database and re-open it from the same network...
18
by: WStoreyII | last post by:
I am making a asp page that will run on my computer by iis. But the problem is the database in on a web server. I can not seem to get the connection to work for it though here his the connection...
14
by: WebMatrix | last post by:
Hello, I have developed a web application that connects to 2 different database servers. The connection strings with db username + password are stored in web.config file. After a code review,...
10
by: cleo | last post by:
I am migrating from VB6/Access to Visual Basic and SQL Express. I have success writing test code on my local machine and am now setting up tests for deployment to a server. I have installed SQL...
16
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
7
by: Bill Nguyen | last post by:
I have this connection string using ODBC DSN Dim FactorJaco As String = "dsn=jaco;catalog=factor;uid=user;pwd=passord" This requires an ODBC DSN (jaco) at every client PC. I need to use DSN-less...
8
by: mark_aok | last post by:
Hi all, I have a split database. Both the forms, and the tables are stored on a shared network drive (this is Access 2003). The users use the forms, and the tables on the network drive, there...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.