sqlCommand1.Connection.Open(); //不要
更改为在初始化
SqlCommand sqlCommand1=new (strCmd,sqlConnection1);
更改为在初始化
SqlCommand sqlCommand1=new (strCmd,sqlConnection1);
解决方案 »
- asp.net里“/”应用程序中的服务器错误。
- 有关xss攻击,html事件中加入特殊编码还会执行吗
- C#如何调用其他页面中的方法
- asp.net 弹对话框问题(给我弄的老郁闷了)
- 求:程序天下ASP经典模块开发大全这本书里面的实例源文件
- 如何将上传的图片文件保存在一个指定的目录中
- 用户登陆互斥问题
- 我写了一个函数,通过URL从网上得到图片,然后再存到本地,可是存到本地时图片却有点不一样?
- treeview里如何指定某个节点被选中状态,页就是说背景和其它节点有差异
- .net如何重新注册?
- 在线等待--怎样在Page_load中调用TreeView 的SelectedIndexChange事件
- 概念问题:关于writer.AddAttribute(HtmlTextWriterAttribute.Style,pageStyle)
sqlConnection1.ConnectionString=strConn;
sqlConnection1.Open();
我看应该没有多大问题,不知是不是其它的原因呢??请教!!
string strConn="server=xw;uid=sa;pwd=sa;database=Car";
sqlConnection1.ConnectionString=strConn;
SqlCommand sqlCommand1=new (strCmd,sqlConnection1);
sqlConnection1.Open();
sqlCommand1.ExecuteNonQuery();
............................................................
sqlCommand1.CommandText=cmd;
sqlCommand1.Connection.Open();//这一句就不用写了,最好将上一个sqlConnection1.Open();写到这里
sqlCommand1.ExecuteNonQuery();
sqlCommand1.Connection.Close();//这里就改成sqlConnection1.Close();
故前面已有申明的
namespace MyCharu
{
/// <summary>
/// 承包信息维护 的摘要说明。
/// </summary>
public class 承包信息维护 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
protected MyCharu.xwDataSet1 xwDataSet11;
protected System.Data.SqlClient.SqlCommand sqlCommand1;
public Hashtable RbListIndex;
public Hashtable DrpListIndex;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.Label Label8;
static int k=1;
改为
TextBox TextBox1=(TextBox)e.Item.Cells[数字].FindControl("TextBox1");
改为
TextBox TextBox1=(TextBox)e.Item.Cells[数字].FindControl("TextBox1");
???为什么要改为数字呢??
sqlCommand1.Connection.Open();
sqlCommand1.Connection.Close();
sqlCommand1.Connection.Open();
sqlCommand1.Connection.Close();