c# - Connecting to a database from the beginning -


I am working in a business writing advanced software application, and obviously the need for our SQL server and all connection wires is. This is fine for my job - but what if I want to do this for a new (very small) business ... If I want to buy a small database server and want to install a piece of software on this server How can I go about the existing database, how to talk to the server and connect to the code (C #) and b) to make me possible about things like internet / phone connections etc. What need does?

EDIT: This will be the reason for the server, because access to 2 or 3 different computers in different locations will be needed?

There are actually a few ways to create a database connection, but I would say one of the easiest ways Use methods and sections found in An original connection will look something like the following:

  using System.Data.SQLClient; Namespace Your Namespace {Public class database connection {public datatype getData () {datatype dataobject = new datatype (); SqlConnection testConn = New SqlConnection ("Connection String" here); SqlCommand testCommand = New SqlCommand ("Choose * from dataTable", testConn); {Reader.Read ()) {// Get data from reader and set in datatype object}} Return data OBJ; when using TestConn.Open () (SqlDataReader Reader = testCommand.ExecuteReader ()); Keep in mind, this is a very simple, simple version of a connection to read data, but you should do what you need to do. Be sure to use the "use" or "try / hold" statement to ensure that the connection is closed and resources have been released after it has been released (whether to successfully obtain data). 

In the beginning, I would suggest to only create a database on the local machine and run a test from which other tools you might need. Once you assure business data back and forth, feel free to visit the database in another box or an online server. The type of any internet connection should be sufficient, although I can not guarantee bailout for dial-up, it has not been used in years.

A final note, if you decide to go to an online server system, make sure that the service you use allows for external connections Some services use shared server systems , And force users to manage and write databases in order to use their internal database interface.

--- ADT ---

For the server system, create a separate box on your own local network that you can view, and the database software of your choice. Can load. Since you are using C #, it will be easier to go with Microsoft SQL Server 2005/2008. Installation is quite straightforward, and it will prompt you to automatically create your first database while installing.

After installation, it will depend on you to add tables, stored procedures, custom functions, etc. ... Once you have your base structure, go ahead and make some simple connections. Use code. Since you are familiar with the above methods, I am sure that you know that you really need to have the server machine and the database to target on the path in the connection string.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -