vb翻写成C#,简单!!!!

junmingl 2003-05-28 03:01:49
private DataView GetRy()
{
DataSet dstRy;
SqlConnection conRy;
SqlDataAdapter dadRy;
DataView dvwRy;

dvwRy =(DataView)Cache["Ry"];
if (dvwRy is nothing)
{
dstRy = new DataSet();
conRy = new SqlConnection(ConfigurationSettings.AppSettings["MyCon"]);
dadRy = new SqlDataAdapter("select * from mydbt",conRy);
dadRy.Fill(dstRy,"mydbt");
dvwRy = dstRy.Tables["ptt_ry"].DefaultView;
Cache["Ry"] = dvwRy;
}
return dvwRy;
}

该段代码总是通不过编译,问题出在dvwRy is nothing,这句是VB的语法,请问各位大侠c#中该怎么写?
...全文
39 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Knight94 2003-05-28
  • 打赏
  • 举报
回复
>>dvwRy is nothing

dvwRy==null //in C#
jinye 2003-05-28
  • 打赏
  • 举报
回复
dvwRy==null
latahu 2003-05-28
  • 打赏
  • 举报
回复
DataView dvwRy=new DataView();分配一下实例
Edward 2003-05-28
  • 打赏
  • 举报
回复
Haha. It should read this in C#:

null == dvwRy
zwztu 2003-05-28
  • 打赏
  • 举报
回复
改成if(dvwRy==null)

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧