哪位大哥能告诉小弟下面这段语言是什么意思啊?
private void btn_submit_Click(object sender, System.EventArgs e)
{
if(Page.IsValid )
{//从文件Web.config中读取连接字符串
string strconn= ConfigurationSettings.AppSettings["abc"];
//连接本地计算机的LMS数据库,创建两连接
SqlConnection cn= new SqlConnection (strconn);
cn.Open ();
SqlConnection cn2= new SqlConnection (strconn);
cn2.Open ();
//利用Command对象调用存储过程,创建添加book表命令类型
SqlCommand cmbookadd=new SqlCommand ("bookadd",cn);
//将命令类型转为存储类型
cmbookadd.CommandType =CommandType.StoredProcedure ;
//添加并给参数付值
cmbookadd.Parameters .Add ("@BID",SqlDbType.Int);
cmbookadd.Parameters .Add ("@BISBN",SqlDbType.VarChar);
cmbookadd.Parameters .Add ("@BName",SqlDbType.VarChar);
cmbookadd.Parameters .Add ("@BAuthor",SqlDbType.VarChar);
cmbookadd.Parameters .Add ("@BPress",SqlDbType.VarChar );
cmbookadd.Parameters .Add ("@BTheme",SqlDbType.VarChar );
cmbookadd.Parameters .Add ("@BClassifyText",SqlDbType.VarChar );
cmbookadd.Parameters .Add ("@BIndex",SqlDbType.VarChar );
cmbookadd.Parameters .Add ("@BPrice",SqlDbType.Money );
cmbookadd.Parameters .Add ("@BSeriesName",SqlDbType.VarChar );
cmbookadd.Parameters .Add ("@BDescribe",SqlDbType.VarChar);
//利用Command对象调用存储过程,创建添加BookMaxBIDGet表命令类型
//该类型返回我们所要往book,bookprice表中添加的BID值
SqlCommand cmbookmaxbidget=new SqlCommand ("BookMaxBIDGet ",cn2);
//将命令类型转为存储类型
cmbookmaxbidget.CommandType =CommandType.StoredProcedure ;
//添加并给参数付值
cmbookmaxbidget.Parameters .Add ("@maxbid",SqlDbType.Int);
//将BookMaxBIDGet过程参数输出
cmbookmaxbidget.Parameters ["@maxbid"].Direction =ParameterDirection.Output ;
cmbookmaxbidget.ExecuteReader ();
string maxbidstring=cmbookmaxbidget.Parameters ["@maxbid"].Value.ToString();
//考虑数据库为空的情况,maxbidstring将为空
int maxbid ;
if(maxbidstring=="")//如果数据库为空
{
maxbid=20000 ;
}
else//如果数据库有数据
{
maxbid=Convert.ToInt32(maxbidstring)+1 ; //取出表中BID的最大值作为下一纪录的BID
}
//往book表中参数付值
cmbookadd.Parameters ["@BID"].Value =maxbid;
cmbookadd.Parameters ["@BName"].Value =tbx_bname.Text .ToString ();
cmbookadd.Parameters ["@BISBN"].Value =tbx_bisbn.Text .ToString ();
cmbookadd.Parameters ["@BAuthor"].Value =tbx_bauthor.Text .ToString ();
cmbookadd.Parameters ["@BPress"].Value =tbx_bpress.Text .ToString ();
cmbookadd.Parameters ["@BTheme"].Value =tbx_btheme.Text .ToString ();
cmbookadd.Parameters ["@BClassifyText"].Value =tbx_bclassifytext.Text .ToString ();
cmbookadd.Parameters ["@BIndex"].Value =tbx_bindex.Text .ToString ();
cmbookadd.Parameters ["@BPrice"].Value =Convert.ToDouble (tbx_bprice.Text .ToString ());
cmbookadd.Parameters ["@BSeriesName"].Value =tbx_bseriesname.Text .ToString ();
cmbookadd.Parameters ["@BDescribe"].Value =tbx_bdescribe.Text .ToString ();
cmbookadd.ExecuteNonQuery ();
//关闭连接
cn.Close();
cn2.Close ();
Response.Redirect("bookmanage.aspx");
}
}
}
}