Click here to Skip to main content
11,484,941 members (74,967 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# database LAN
I am new to Database applications. I have one question. Suppose I have an application which is running on 10 PCs which are on the LAN. Each user on their PC enters and retrieves data.

Can I achieve this functionality by just using ConnectionString?
This means giving the address of database on the Server which is one of the 10 PCs on the LAN.
Posted 6-Jan-11 22:11pm
Edited 6-Jan-11 22:18pm
v3
Comments
OriginalGriff at 7-Jan-11 3:35am
   
Answer updated

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Yes. Sort of.

You would have a ConnectionString which supplies the address and login details for the database, but after that you need to supply code or browser html to access the database itself and enter / extract the records.

Note I would suggest that for the DB you look at MsSql or MySql, but avoid Access as the latter can be difficult to work int a multiuser environment. The other two are well used to it!


"i seems it was to difficult, i have to use TCP/IP and ETC....
But thank GOD and Thank for Answering that Just ConnectionString Do the whole the thing.........
thanks a lot......... - Pritesh Aryan 1 min ago"



It's not too difficult: at it's most basic:
DataSet ds = new DataSet();
string sql = "SELECT * FROM myTable";
using (SqlConnection conn = new SqlConnection(connectionString)) 
   {
   conn.Open();
   using (SqlDataAdapter da = new SqlDataAdapter(sql, conn)) 
      {
      da.Fill(ds);
      }
   }
myDatagridview.DataSource = ds;
Will read all records from the "myTable" table and display them in WinForms. Similar code works for browser based systems.

You need to read up on this: there is a lot on the web, but try starting with MSDN and look at SQLConnection, it will at least give you the basics (if not the finer points - for that you will need a big, thick book!)
  Permalink  
v2
Comments
thatraja at 7-Jan-11 13:27pm
   
Good answer
yaprig at 7-Jan-11 4:05am
   
my 5 points for this answer:)
Pritesh Aryan at 7-Jan-11 4:31am
   
@yaprig, ya you are right but you can also elaborate more
Dalek Dave at 7-Jan-11 3:48am
   
Great Answer, very comprehensive.
Pritesh Aryan at 7-Jan-11 3:28am
   
i seems it was to difficult, i have to use TCP/IP and ETC....
But thank GOD and Thank for Answering that Just ConnectionString Do the whole the thing.........
thanks a lot.........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 330
1 Maciej Los 280
2 Raje_ 155
3 Mehdi Gholam 150
4 OriginalGriff 133
0 Sergey Alexandrovich Kryukov 8,494
1 OriginalGriff 7,948
2 Sascha Lefèvre 3,199
3 Maciej Los 2,681
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 7 Jan 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100