<script language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
string ConnStr;
ConnStr="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=User";//User为表名
SqlConnection conn =new SqlConnection(ConnStr);
SqlCommand comm =new SqlCommand();
comm.CommandText="dt_insertuser1";//有一dt_insertuser1的存储过程,实现的是插人;
comm.Connection=conn;
comm.CommandType=System.Data.CommandType.StoredProcedure;
conn.open(); dgOutput.DataSource=comm.ExecuteReader();
dgOutput.DataBind();
conn.Close(); }
</script>
private void Page_Load(object sender, System.EventArgs e)
{
string ConnStr;
ConnStr="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=User";//User为表名
SqlConnection conn =new SqlConnection(ConnStr);
SqlCommand comm =new SqlCommand();
comm.CommandText="dt_insertuser1";//有一dt_insertuser1的存储过程,实现的是插人;
comm.Connection=conn;
comm.CommandType=System.Data.CommandType.StoredProcedure;
conn.open(); dgOutput.DataSource=comm.ExecuteReader();
dgOutput.DataBind();
conn.Close(); }
</script>
解决方案 »
- listBox1.SelectedItem.ToString()取值的问题
- 从数据库中读时间,如何设置读出的时间格式
- 关于即时窗口 变量 即时显示问题
- 如何在TextBox中完全屏蔽字符
- 做一个最简单的treeview显示文本信息
- c#如何实现如迅雷或QQ显示详情
- 怎样获取本机电脑中的浏览器,以及浏览器中的地址
- 請問誰會寫遊戲外掛或者外掛教程也可以寫些
- (winform)请问怎么才能在一个窗体访问另一个窗体的组件?有代码!
- 哪位知道C#里有没有IPAdress类和IPToString方法?
- 急!在ASP.NET中使用CrystalReport时,提示错误“未将对象引用设置到对象的实例”。
- 请教一个数据库问题(急)谢谢!!!
无法打开登录 'User'中请求的数据库。登录失败。用户 'ZHANGLEI\ASPNET' 登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 无法打开登录 'User'中请求的数据库。登录失败。用户 'ZHANGLEI\ASPNET' 登录失败。
2.在WebConfig中加入<identity impersonate="true" />