ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DB操作打个比方

DB操作打个比方

原创 Linux操作系统 作者:kirinri 时间:2009-11-23 15:19:21 0 删除 编辑

给别人打个比方,自己真有才,记下来。呵呵


// 比如做饭:煮方便面

SqlConnection myConnection = new SqlConnection(conString);          //开煤气
myConnection.Open();                                                //点火
SqlDataAdapter adapter = new SqlDataAdapter(strSQL, myConnection);  //我把方便面放到这个炉灶上煮
adapter.Fill(ds, "employee");                                       //煮好了倒到碗中
myConnection.Close();                                               //关火

 

// 比如做饭:做宫保鸡丁
SqlConnection con = new SqlConnection(connectString);                            //开煤气
con.Open();                                                                      //点火
SqlCommand cmd = new SqlCommand("dbo.bitCMS_ConvertVideo_GetList", con);         //确定菜名“宫保鸡丁”
cmd.CommandType = CommandType.StoredProcedure;                                   //大连川菜“微辣”

SqlParameter processDT = new SqlParameter("@ProcessDateTime", DbType.String);    //鸡肉,辣椒等
processDT.Direction = ParameterDirection.Input;
processDT.Value = processDateTime;

cmd.Parameters.Add(processDT);                                                   //构成“宫保鸡丁”
SqlDataAdapter dataAapter = new SqlDataAdapter(cmd);                             //开炒
dataAapter.Fill(dsVideoList);                                                    //出锅
con.Close();                                                                     //关火

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12476590/viewspace-620320/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-21

  • 博文量
    257
  • 访问量
    543628