Click here to Skip to main content
16,016,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
0 down vote favorite


I am learning C# and I want to access a database. I have been searching pages on .net database connectivity for the last two - three days. I also came to know that it has several ways for the connectivity and this is exactly where my mind started to ask a number of questions. Please tell me if I am wrong in my understanding.

Check out this Diagram 1 :
http://sdrv.ms/LVWa7H[^]

Now what I am getting here are five ways of connectivity:

Linq to Objects
Linq to Datasets
Linq to SQL
Linq to Entities
Linq to XML

Here is another Diagram 2 of ADO.net Architecture -
http://sdrv.ms/LVWfrX[^]

I have read the definitions, but am not able to differentiate the functionality and purposes. Can anyone give me a short explanation of both diagrams for my understanding?

1) Suppose I am a programmer who write code in C#; which way should I prefer to write desktop based has database connectivity that has future?

2) To Software Developer is it needed to go through all the preceding ways of data access from database?
Posted
Comments
Jubayer Ahmed 13-Feb-14 0:13am    
1. First you should know what kind of databases you are using.
2. You know LINQ? Why you need LINQ??

look i agree with them ... in a short post you are going to get very cryptic information... il give you the hints i have but i would really reaf through what they have posted.

personally it all depends what function your database wil be performing, the cosept of a sql database is brilliant but useless when it comes to installing the application on other computers without the local sql database, then it is better to write your own sort of database through carefully architected textfilebase with its own security, or if your lazy make a connection to excel ...

if you want to set up a loacal aria network sql connection, you need to set the permissions on a account for everyone to connect to, you do this by
-going into sql serber manager studios
-opening the database you want to connect to,
-in the left hand side click on securitys in object explorer
- under login click on sa to create a account or if you alreaddy created the account click on it
- go to its properties and select server role, make it admin or what ever you want it to do
- then go to securables and choose what options and roles this user has to the database, important to remember is that you must set connect to sql database and create any database, but rest you choose.

in VS(Windows application)

the connection string is something like this

//Creating connection to local database (connection should be converted to vpn database connection)

SqlConnection cn = new SqlConnection(@"Data Source=tcp: IP or Server Network Name;Initial Catalog=tblDatabase;User ID=****;Password=****");

you cant use integrated security on this because it will probably tell you that the connection cant be establish the user is in a untrusted domain or insecure domain, so you need to connect with sql authentication(note the login id and password, that is the id and password of yhe account you created in sql).

to connect to a online one, you have to pay someone to host it and they wil give you a string you can connect to on sql, then everything else is basically the same, the connection string will then be used to connect to the datebase will only in ip have the ip of the server it should connect to.

hope this help, im not sure if its the answer you wanted but i really suggest you read through the things the other posted.
 
Share this answer
 
Your really not going to get the information you need from a "short" forum post or two.

It sounds as though you need to start with a book on ADO.NET[^].
 
Share this answer
 
Comments
Member 10524556 12-Feb-14 22:53pm    
I am definitely going to start with but the question is "in which way"?
Jubayer Ahmed 13-Feb-14 0:28am    
common rule does not work for all.you have to find out your own way...start from the basic...
Dave Kreskowiak 13-Feb-14 8:36am    
You pick the one that is appropriate for your particular application case. There is no one method that is "best" for all applications. Learn about the different methods and pick the one that best suits your current project.
hii
You simply start with Micrsoft DataBase File(.mdf) ,available in setup in vs2010 , simple to create ,get connection string.
Now just desigm one registeration phase ,name and last name ,insert that values in database ,try to update ,delete ,values .When this all things works u will get little bit confidence ,and you may work with any database ,like mysql ,mssql etc .You just need to start work ,where u stuck come here , post question ...But u just start work .
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900