C#asp.net 连接使用sqlite 数据库的代码怎么写 15
1个回答
展开全部
引用命名空间
using System.Data;
using System.Data.SqlClient;
//1.连接
string connString = "Data Source=.;Database=db_BBS;Integrated Security=True;";
SqlConnection conn = new SqlConnection(connString);
try
{
conn.Open();
SqlCommand comm = new SqlCommand();
comm.Connection = conn;
}
catch (Exception ex)
{
throw;//来抛出发生异常的根本来源
}
finally
{
conn.Close();
}
using System.Data;
using System.Data.SqlClient;
//1.连接
string connString = "Data Source=.;Database=db_BBS;Integrated Security=True;";
SqlConnection conn = new SqlConnection(connString);
try
{
conn.Open();
SqlCommand comm = new SqlCommand();
comm.Connection = conn;
}
catch (Exception ex)
{
throw;//来抛出发生异常的根本来源
}
finally
{
conn.Close();
}
追问
这是sqlite么?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询