VS连接数据库,这里介绍C#的连接方式,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
/// summary
/// DBConnection 的摘要说明
/// /summary
public class DBConnection
{
private static string connectionString = ;
public DBConnection()
{
//connectionString = System.Configuration.ConfigurationManager.ConnectionStrings[ConnectionString].ConnectionString;
connectionString = Data Source=localhost;Initial Catalog=myDB;Integrated Security=SSPI;
}
public SqlConnection getDBConnection()
取消
评论