1

I need a database for a web project (and for off-line projects as well). The problem is I don't know where to start and googling returns more advanced stuff. Where do I start?

I already have Visual Studio 2010 and Visual Web Developer 2010 installed (both – the express version). I'm not sure I have what is needed for SQL (which, correct me if I'm wrong, is what I need for databases). In my start button I have two folders named "Microsoft SQL Server 2008" (one of them with an "R2" at the end). But my computer isn't a server, just a PC. Am I supposed to install something on my PC? If so – which of the two? (The one with the "R2" or the one without it)

All I need is to create a simple database so I can store and retrieve information easily instead of reading a text file....

4 Answers 4

2

well, you need SQL Server installed. Try searching your computer for it, you may have it installed. The easiest way is to run services.msc and look for SQL Server.

See here, I have 3 instances installed but just one running (INSTANCE2008 is the name I gave to it, you will probably have SQLEXPRESS or MSSQLSERVER):

enter image description here

If it is installed you will need SQL Server Management Studio to create your database. You will probably have it under: enter image description here

once you access it, just connect to your server (usually called localhost), right click on the database folders and select "new database"

enter image description here

from that, it is really easy to create your DB, just follow the steps

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. Your answer helped me create a DB.
1

Sounds like you have all the tools you need to get started, however you might also need SQL Management Studio as well.

But "How to start creating and using databases?" is sort of a broad question. If your question is really about application design, then you would start 'creating databases' when you've defined your model. Once your model is defined, then you can start creating the database.

If your question really is about creating and using databases, SQL Management Studio should get you on the right track. It's a point n' click way to creating databases, tables, stored procs, etc.

Using the database... hmmm. The easiest way is to integrate Microsoft's Enterprise Library 5. Again, point n' click interface to setting up the connection in your web.config (or app.config) and plenty of examples.

1 Comment

Thanks. I'm now downloading SQL Management Studio.
1

You can import the System.Data and System.Data.SqlClient library in your application, like

using System.Data;
using System.Data.SqlClient; 

and research about the SqlConnection class.

about SQL Statements, the W3Schools has a good reference.

A simple method sample that has a connection

protected void connection()
{
  using(SqlConnection conex = new SqlConnection("your_connection_string"))
  {
    SqlCommand comand = new SqlCommand();
    comand.CommandText = "SELECT * FROM Table";
    comand.CommandType = CommandType.Text;
    comand.Connection = conex;
    conex.Open();
    comand.ExecuteNonQuery();
    SqlDataAdapter da = new SqlDataAdapter(comand);
    DataTable dt = new DataTable();
    da.fill(dt);
  }  
}

Comments

0

You will be having your database on your server. You can directly connect to that database with just a slight configuration in web.config.

OR

If you found "SQL Server Management Studio" in your Microsoft SQL Server 2008 R2 click on it and login to the sql server / express instance of the sql server.

Create the database there.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.