| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 489 人关注过本帖
标题:[求助]未将对象引用到实例
取消只看楼主 加入收藏
longlongjiaz
Rank: 1
等 级:新手上路
帖 子:64
专家分:0
注 册:2006-11-11
收藏
 问题点数:0 回复次数:0 
[求助]未将对象引用到实例

private void getdata()
{
SqlDataAdapter mycmd= new SqlDataAdapter(mysql, mysqlcon);
DataTable dt= new DataTable();
mycmd.Fill(dt);
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
mysqlcon.Close();

}


//判断是否为全为数字
public bool IsNumeric(string strNumber)
{
strNumber="";
Regex NumberPattern=new Regex("[^0-9.-]");
return !NumberPattern.IsMatch(strNumber);
}


private void Page_Load(object sender, System.EventArgs e)
{
try
{
//根据传入参数判断用户请求

string jobkinds = Request.Params["jobkinds"].ToString ();
string jobname= Request.Params["jobname"].ToString ();
int model = Convert.ToInt32(Request.Params["model"].ToString ());
if(IsNumeric(Request.Params["model"].ToString ()))
{
switch( model)
{

//用户根据工作类别查看工作职位

case 1:

mysql = "select newjobs.comid, newjobs.jobname, newjobs.jobkinds, " +
" newjobs.peoplecount, newjobs.pubtime, newjobs.endtime, cominfor.comname " +
"from newjobs, cominfor where newjobs.comid= cominfor.comid and " +
" newjobs.jobkinds='" + jobkinds + "' and newjobs.endtime>getdate() " +
"and newjobs.jobstate=0 order by newjobs.id desc";
break;


//用户根据职位关键字与工作类别组合条件进行检索

case 2:

mysql = "select newjobs.comid, newjobs.jobname, newjobs.jobkinds, " +
" newjobs.peoplecount, newjobs.pubtime, newjobs.endtime, cominfor.comname " +
"from newjobs, cominfor where m newjobs.comid= cominfor.comid and " +
" newjobs.jobkinds='" + jobkinds + "' and newjobs.jobname like'%" + jobname + "%' and " +
"endtime>getdate() and newjobs.jobstate=0 order by newjobs.id desc";
break;


// 用户根据职位关键字进行检索

case 3:
mysql = "select newjobs.comid, newjobs.jobname, newjobs.jobkinds, newjobs.peoplecount," +
" newjobs.pubtime, newjobs.endtime, cominfor.comname from newjobs, cominfor where " +
" newjobs.comid= cominfor.comid and newjobs.jobname like'%" + jobname + "%' and " +
" newjobs.endtime>getdate() and newjobs.jobstate=0 order by newjobs.id desc";
break;

//所有职位

case 4:
mysql = "select newjobs.comid, newjobs.jobname, newjobs.jobkinds," +
" newjobs.peoplecount, newjobs.pubtime, newjobs.endtime,cominfor.comname " +
"from newjobs, cominfor where newjobs.comid= cominfor.comid and " +
" newjobs.endtime>getdate() and newjobs.jobstate=0 order by newjobs.id desc";
break;
}

getdata();
}
}
catch(Exception ee)
{
Response.Write (ee.Message);

}

搜索更多相关主题的帖子: 实例 对象 
2006-11-19 15:55
快速回复:[求助]未将对象引用到实例
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036863 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved