473,385 Members | 1,742 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,385 software developers and data experts.

Client/Server application with SQL Database on Server side? C#

I have a project. I have to build a client server application and i have to access(and run some queries) to ms sql database which is at server side, from client application. How can i build this structure? Client should use tcp to connect server and access to database at server's side.
Jan 17 '10 #1

✓ answered by tlhintoq

So your question really is
"How do I build an entire client/server database-enabled application?" ?

I am reminded of the the old story:
Q: How do I eat an elephant, its so big?
A: One little bite at a time.

So in your case the answer would be: One little byte at a time.
  1. Get a set of whiteboards
  2. Get a discount card for your best bookstore
  3. Identify all the major components and needs. This is everything from defining all the datastructures you need to pass around to the various screens and levels of permissions your users will need. Who can edit data and who can only see it?
  4. Identify all the technologies that you think you need.
  5. Identify all the technologies that you don't understand.
  6. Make a project just for learning that one technology: Database; TCP/IP communication, XML serialization, whatever
  7. Learn each small part on it's own. (This is where the bookstore loyalty program card comes in)
  8. Then start version 1 of the big project where you start integrating all your new knowledge.
  9. After making version 1 and learning and realizing all the places where you could have done something better, start completely fresh with a new project to be version 2.

2 7972
tlhintoq
3,525 Expert 2GB
So your question really is
"How do I build an entire client/server database-enabled application?" ?

I am reminded of the the old story:
Q: How do I eat an elephant, its so big?
A: One little bite at a time.

So in your case the answer would be: One little byte at a time.
  1. Get a set of whiteboards
  2. Get a discount card for your best bookstore
  3. Identify all the major components and needs. This is everything from defining all the datastructures you need to pass around to the various screens and levels of permissions your users will need. Who can edit data and who can only see it?
  4. Identify all the technologies that you think you need.
  5. Identify all the technologies that you don't understand.
  6. Make a project just for learning that one technology: Database; TCP/IP communication, XML serialization, whatever
  7. Learn each small part on it's own. (This is where the bookstore loyalty program card comes in)
  8. Then start version 1 of the big project where you start integrating all your new knowledge.
  9. After making version 1 and learning and realizing all the places where you could have done something better, start completely fresh with a new project to be version 2.
Jan 17 '10 #2
One1
1
To connect to SQL Server from C#.NET, you need to create a connection string such as below:

private SqlConnection connection;
private string connectionString =
@"Server=(local);Database=Embedding_SQL_Test;Us er ID=sa;Password=123";
connection = new SqlConnection( connectionString );

Next, you use the SqlConnection object created above to create a 'SqlCommand', as shown below:
SqlCommand cmd = new SqlCommand( "select * from Customer where CustomerID = @Cid", connection);

The SQL query shown here can be replaced by a SELECT, INSERT, UPDATE queries etc.

Next to execute the SQL queries in the database, you use the following methods:
ExecuteReader - to execute SELECT queries
ExecuteNonQuery - to execute INSERT, DELETE, UPDATE, and SET statements.

This is a very short description of how to connect to SQL Server database from C# and execute SQL queries in the database.
For details about the connection string, the methods and their parameters check the following link: ( http://www.shahriarnk.com/Shahriar-N...harp-Java.html )
Here you will also find details about how to pass parameters to the SQL queries as well as calling stored procedures and much more.
Sep 18 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mick Turner | last post by:
I have connected to SQL Server database (server-side vbscript) and read some data from the tables. This works correctly. I now have the data in an array (server-side). I have to draw a...
5
by: Matt | last post by:
I think this is the basic concept in ASP server-side development. My boss told me web application is NOT client-server application. I argued with him because browser is the client, and the server...
18
by: cjl | last post by:
Hey all: I know that it is silly in the age of Google to 'lose' something on the internet, but I recently checked out a project that had implemented a database with a subset of SQL in pure...
4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
6
by: Ken Allen | last post by:
I am relatively new to .Net and C#, but I hav ebeen programing in other languages and done some COM work for a number of years. I am attempting to understand how to map an older program...
10
by: Ben | last post by:
Hi, I made an application in classic asp (reservation of books and video stuffs for students) and want to migrate to asp.net. The user has to chose a date, then pushung on a submit button. The...
1
by: hendyhanusin | last post by:
Dear all, 1. Currently, i have a database windows application and it's attached to a card reader device on client computer... in intranet (TCP/IP network), it's easy to maintain this client...
2
by: Wimpie van Lingen | last post by:
Hey I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter. My solution consists of 4 projects: - Class Library containing the server classes...
6
by: sgulciny | last post by:
hi friends; I have problem about sql server insert and update in client side. I am coding windows application with c#.When I run my code in database server computer all is fine.I can see data,...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.