I am developing a website using WebMatrix in Asp.net. I have downloaded and installed SQL Server . Now I don't know how to create a database in SQL Server and how to connect to it using Razor Syntax/Method.
我正在使用Asp.net中的WebMatrix开发一个网站。我已经下载并安装了SQL Server。现在我不知道如何在SQL Server中创建数据库以及如何使用Razor语法/方法连接它。
2 个解决方案
#1
3
WebMatrix is easy to connect to SQL Server; there is an old tutorial that can lead you: Connecting to a SQL Server or MySQL Database in WebMatrix.
WebMatrix很容易连接到SQL Server;有一个老教程可以引导您:连接到WebMatrix中的SQL Server或MySQL数据库。
With regard to create a table in SQL Server, there are books on how to accomplish this task. The easy way is to use SQL Server Management Studio. Googling I have found this tutorial that maybe could help: Creating databases using SQL Server Management Studio Express.
关于在SQL Server中创建表,有关于如何完成此任务的书籍。简单的方法是使用SQL Server Management Studio。谷歌搜索我发现本教程可能会有所帮助:使用SQL Server Management Studio Express创建数据库。
#2
0
If you want to work in razer and want to connect with data base and retrieve data.
如果您想在razer中工作并希望连接数据库并检索数据。
var db = Database.Open("Employee");
var dbCommand = "SELECT * FROM Movies WHERE ID = '1'"; // Select the name where id=1
var row = db.QuerySingle(dbCommand);
if(row != null)
{
var employee_name = row.Name;
}
#1
3
WebMatrix is easy to connect to SQL Server; there is an old tutorial that can lead you: Connecting to a SQL Server or MySQL Database in WebMatrix.
WebMatrix很容易连接到SQL Server;有一个老教程可以引导您:连接到WebMatrix中的SQL Server或MySQL数据库。
With regard to create a table in SQL Server, there are books on how to accomplish this task. The easy way is to use SQL Server Management Studio. Googling I have found this tutorial that maybe could help: Creating databases using SQL Server Management Studio Express.
关于在SQL Server中创建表,有关于如何完成此任务的书籍。简单的方法是使用SQL Server Management Studio。谷歌搜索我发现本教程可能会有所帮助:使用SQL Server Management Studio Express创建数据库。
#2
0
If you want to work in razer and want to connect with data base and retrieve data.
如果您想在razer中工作并希望连接数据库并检索数据。
var db = Database.Open("Employee");
var dbCommand = "SELECT * FROM Movies WHERE ID = '1'"; // Select the name where id=1
var row = db.QuerySingle(dbCommand);
if(row != null)
{
var employee_name = row.Name;
}