tags:

views:

47

answers:

1

I am doing a project of web application. I am still a beginner and have certain query. please let know what all steps i need to take up..

  • Whether SQL SERVER 2005 can be used with Visual studio 2008?
  • I have the above mentioned software's installed. I installed Visual studio 2008 professional edition and which atuomatically installed Sql server 2005.
  • How should i start the connection. I did start SQL server 2005 service by running the SQL server (SQLEXPRESS)
  • The main thing is i need to create tables in the backend database whcich i can use in visual studio '08.

Please help me with this problems.. Thank you in advance

+2  A: 

To create tables you should use SQL Management Studio (an Express edition is available).

To easily interact with these tables in Visual Studio, right click on your project, go Add New Item -> Data -> LINQ to SQL Classes (call it DB.dbml or Base.dbml or something similar).

Now go View on the top menu -> Server Explorer.

Right Click on Data Connections -> Add Connection -> Microsoft SQL Server -> Put your Server Name (probably YOUR-PC\SQLEXPRESS), Select your database.

Now you can drag tables onto the dbml workspace.

Now build, and you can reference your tables in code like this:

DBDataContext db = new DBDataContext();
Car[] cars = db.Cars.Where(c => c.Make = "Ford").ToArray();

You might need to enable TCP/IP and Named Pipes for your SQL Server Express using the SQL Configuration Manager (Google for more details).

Graphain
@Graphain than you for your reply.. one more query.Now that i have downloaded SQL Management Studio and installed.. i have got now an option for sql management in the folder MS SQL SERVER 2005.The thing is i even created my server login with respect to my PC name.Which is the file in the database in which i should type the create table statements? There is this option on left saying Master and model under Database hierarchy which again then consists this table and all.So which file to choose among them to write? Thank you very much.Even if there is any good book which can help me!
Nagaraj Tantri
You need to make a new database. Master is the default database that holds information about the others. Don't edit this one. Just right-click create new database.
Graphain
Thanks a lot :)
Nagaraj Tantri
is this same as creating a schema? i mean if i had to manually type CREATE SCHEMA where can i do it? or infact how can i?
Nagaraj Tantri
I think we're talking the same thing. It lets you make a database then you can make tables/views/stored procedures. Alternatively you can click New Query at the top left and write manual SQL
Graphain
yeah okay.. thanks a ton :)
Nagaraj Tantri
@Graphain i have two authentication's. one which is windows and another SQL server. since i am creating a web enabled database which one should i choose to create a DB? and The other problem is If i select SQL server authentication it ask's me login name n password, in which case i m doing this project on my PC. not connected to any internet or anything. so what should i do? please if you could help.. i tried google but mostly people have written in blog saying ask the login name n passwd to the guy who installed it,But i installed it and there wasn't any option at start to create any login
Nagaraj Tantri
I would use windows authentication for now for the lot. You aren't going to have web people access your db, they're going to access your pages which access the db. Later you cant think about create accounts for each web app or whatever that have limited roles. You aren't at that stage yet.
Graphain
@Graphain okay thank you :)
Nagaraj Tantri
@Nagaraj Minor correction: later you can** think about roles (that is you can easily change your connection string later).
Graphain