哪个帮我把这段代码注释一下是什么意思?
来源:百度知道 编辑:UC知道 时间:2024/08/20 11:34:45
using System.Data;
using System.Configuration;
using System.Web;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ShowData();
}
public void ShowData()
{
string Str = "Data Source=DUAN-DOB38JNTEE\\SQLEXPRESS;Initial Catalog=text;Persist Security Info=True;User ID=sa;Password=sa";
SqlConnection con = new SqlConnection(Str);
con.Open();
string sql = "Select * from Customers";
SqlCommand cmd = new SqlCommand(sql,con);
int i = 0;
i=cm
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
'以上代码引用了一些命名空间,就是类似c语言中的头文件一样的东西。
public partial class _Default : System.Web.UI.Page
'公开定义了一个类
{
'定义了一个类的初始化
protected void Page_Load(object sender, EventArgs e)
{
ShowData();'运行这个方法ShowData()
}
'定义方法
public void ShowData()
{
string Str = "Data Source=DUAN-DOB38JNTEE\\SQLEXPRESS;Initial Catalog=text;Persist Security Info=True;User ID=sa;Password=sa";
定义了链接数据库的字符串
SqlConnection con = new SqlConnection(Str);
定义了链接对象
con.Open();
打开了链接
string sql = "Sel