DataTable dt = new DataTable();
增加列:
dt.columns.add("username",Type.GetType("system.String");
dt.columns.add("age",Type.GetType("System.Int32");
赋值:
dt.Rows.add(new object[]{"黄忠",22});
在C#中如何调用应用程序配置文件(app.conifg)中的连接字符串?
如果是connectionStrings,用ConfigurationManager.ConnectionStrings["add的name"].ConnectionString;
如果是appSettings,用ConfigurationManager.AppSettings["add的key"]
带存储过程的SqlHelper类
public static class SqlHelper
{
private readonly static string strcon = ConfigurationManager.ConnectionStrings["sql"].ConnectionString;
public static int ExeucteNonQuery(string sql, CommandType type, params SqlParameter[] pms)
{
using (SqlConnection con = new SqlConnection(strcon))