473,790 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# connection and file access question

Hi,

In C# the SqlConnection=
"data source=192.168. 100.100;uid=MyI D;password=MyPw d;database=ETCs erviceTest
";
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 1846
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******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

In C# the SqlConnection=
"data
source=192.168. 100.100;uid=MyI D;password=MyPw d;database=ETCs erviceTest ";
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*******@hotm ail.nospam.com> ¼¶¼g©ó¶l¥ó·s»D: jY************* *************** **@comcast.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******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

In C# the SqlConnection=
"data
source=192.168. 100.100;uid=MyI D;password=MyPw d;database=ETCs erviceTest ";
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******** *****@TK2MSFTNG P10.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*******@hotm ail.nospam.com>
¼¶¼g©ó¶l¥ó·s»D: jY************* *************** **@comcast.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******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

In C# the SqlConnection=
"data
source=192.168. 100.100;uid=MyI D;password=MyPw d;database=ETCs erviceTest
";
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
8749
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. I have gone back and forth between using a DSN file and a DSN-less connection string and I have found the following issue. When I utilize the DSN file to create the link, there is a step where it asks me to identify a unique key for the file. If I...
5
40409
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 lacation on a different machine, it tells me that the ODBC connection to 'SQL Server Name' failed. How can I create the linked table permenant no matter what machine the networked database is opened on?
18
2650
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 and the error. Any help please. Connection: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=http://n.1asphost.com/WStoreyII/PIMP.mdb" Error: Microsoft JET Database Engine (0x80004005) Not a valid file name. /Default.asp, line 40
14
3507
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, one developer suggested that it's a security flaw; therefore connection strings should be kept somewhere else or encrypted. My argument is that web.config file is protected by IIS and Windows security which is the case. And another argument is that...
10
5797
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 Express on a Windows 2003 Server. I can connect and create databases on the Remote Server from my local machine using SQL Management Express, so I know Remote Access is working. However, I am unable to connect using a connection string within...
16
2876
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 a worker thread that would execute the db commands. The pool was fixed and all the connections were created when the db access class was instantiated. The connections remained opened during the whole execution. If a connection was not available...
20
3301
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 many connection has been used ? 2. If the maximum pool size has been reached, what happens when I call the method Open to open the connection ? Will I get an error ? MSDN says the request is queued, but will I get an error in the open method ? ...
7
7490
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 connection for terminal server setup. Any help is greatly appreciated.
8
13258
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 are no local copies. When connection to this drive is lost, Access CRASHES. It does it every single time. Does anyone know if there is a way to check if
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.