SQL
- 新建(Database Table)
- 查询(单一表, 关联表)
- 存储过程
- 事务
- C# 连接到 sql 数据库
- namespace DAL
{
class SqlHelper
{
static string constring = "server=.,database=MyDataBase, user=sa, pwd=sassa";
public static DataTable ExecuteTable (string safeSql, SqlParameters[] ps)
{
using (sqlConnection con = new SqlConnection(conString))
{
SqlCommand cmd = new SqlCommand(safeSql,con);
cmd.Commandtype= CommandType.StoreProcedure();
if(ps.length>0&& ps!=null )
{
cmd.Paramters.AddReange(ps);
}
con.open();
SqlDataReader reader = cm.ExecuteReader()
DataTable table = new DataTable();
table.Load(reader);
reader.Close();
con.Close();
return table;
}
}
public static object ExecuteSingle()
{
}
public static int ExecutInsertUpdateDelete ()
{
}
}
}
- jbhjb
- nhjn