如何通过会话asp.net显示网格中的记录 [英] how to show the record in grid by session asp.net

查看:48
本文介绍了如何通过会话asp.net显示网格中的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我在登录时如何在网格视图中显示用户记录,我想在页面加载事件的网格视图中显示用户的联系人号码,我需要编码

plz help me tha how i can show the record of users in grid view when he login,i want to show the contacts numbers of user in grid view on page load event ,i need coding

推荐答案

protected void Page_Load(object sender,EventArgs e)

{



if(!Page.IsPostBack )

{



string connectionString =server = SYS2;+integrated security = SSPI;+

database = ERPFinAccounting;

SqlConnection myConnection;

string str_Account_Select =SELECT * FROM AccountsTable;

SqlCommand myCommand;

DataSet myDataSet;

myConnection = new SqlConnection(connectionString);

myConnection.Open();

myCommand = new SqlCommand(str_Account_Select,myConnection);

SqlDataAdapter mySQLDataAdapter;

myDataSet = new DataSet();

mySQLDataAdapter = new SqlDataAdapter(myCommand);

mySQLDataAdapter.Fill(myDataSet,AccountsTable);

GridView1.DataSource = myDataSet;

GridView1.DataBind();



}

}
protected void Page_Load(object sender, EventArgs e)
{

if (!Page.IsPostBack)
{

string connectionString = "server=SYS2;" + "integrated security=SSPI;" +
"database=ERPFinAccounting";
SqlConnection myConnection;
string str_Account_Select = "SELECT * FROM AccountsTable";
SqlCommand myCommand;
DataSet myDataSet;
myConnection = new SqlConnection(connectionString);
myConnection.Open();
myCommand = new SqlCommand(str_Account_Select, myConnection);
SqlDataAdapter mySQLDataAdapter;
myDataSet = new DataSet();
mySQLDataAdapter = new SqlDataAdapter(myCommand);
mySQLDataAdapter.Fill(myDataSet, "AccountsTable");
GridView1.DataSource = myDataSet;
GridView1.DataBind();

}
}


这篇关于如何通过会话asp.net显示网格中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆