打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
代码错误集合
Q:DataGrid的删除事件等不起作用了
A:郁闷,把EnableVviewState属性改为True
-----
Q:把if(Request.Params["id"].Tostring()!=string.Empty){},在URL后面没有ID参数的时候出现错误
A: if(Request["id"]!=nu...
-

Q:DataGrid的删除事件等不起作用了

A:郁闷,把EnableVviewState属性改为True

-----

Q:把if(Request.Params["id"].Tostring()!=string.Empty){},在URL后面没有ID参数的时候出现错误

A: if(Request["id"]!=null){}

-----

Q: public class temp()

{

int shopID = Convert.ToInt32(Session["shopID"]);

...

public function(){}

}

非静态的字段、方法或属性“System.Web.UI.Page.Session”要求对象引用

A: public class temp()

{

...

public function(){

int shopID = Convert.ToInt32(Session["shopID"]);

}

}

-------

Q:如何绑定数据到DropDownList?

A:this.DropDownListTag.DataSource= ds.Tables[0].DefaultView;

this.DropDownListTag.DataTextField = "name";

this.DropDownListTag.DataValueField = "id";

this.DropDownListTag.DataBind();

//为其赋值

this.DropDownListClass.SelectedValue = ds.Tables[0].Rows[0]["类别"].ToString().Trim();

-----

Q:替换函数

A:name=name.Replace("'","\"");

-----

Q:取最新添加的用户的ID

A:string strSql = "INSERT INTO users(email,name,pwd) VALUES('" + email + "','" +name+ "','" + pwd+ "');" ;

strSql = strSql + "SELECT @@identity AS 'identity'";

-----

Q:判断SqlDataReader中有无数据

A:if(reader.Read()) //Read()方法,如果存在多个行,则为 true;否则为 false。

{

int temp = Convert.ToInt32(reader[0]);

reader.Close(); //注意关闭

return temp;

}

else

{

reader.Close();

return -1;

}

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
C#更新SQLServer中的TimeStamp字段(时间戳)
存储过程分页
C# OleDbCommand 和 OleDbDataReader 使用小结
C#入门代码 - C Programmer's Cookbook - C 博客
关于PLMN CELL ID与进制的互转(2<=>10<=>16)
c#中的排序算法(动态数组ArrayList) - 欢迎来到jay的空间 - 博客园
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服