找大神帮忙这个错误怎么解决呢?

问题描述

usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Data.OleDb;usingSystem.Data;publicpartialclassdl:System.Web.UI.Page{OleDbDataAdapterTables;protectedvoidPage_Load(objectsender,EventArgse){OleDbConnectionmycon=newOleDbConnection();OleDbCommandmycomm=newOleDbCommand();DataSetmyds=newDataSet();}//protectedvoidPage_Load(objectsender,EventArgse)//{//}//Button1.Text="确定";////Button2.Text="取消";//if(IsPostBack!=true)//{//string[]zy=newstring[2]{"管理员","学生"};//DropDownList1.DataSource=zy;//DropDownList1.DataBind();//}//}////protectedvoidButton1_Click(objectsender,EventArgse)////{////}//}//protectedvoidButton1_Click(objectsender,EventArgse)//{//OleDbConnectionmyconn=newOleDbConnection();//stringconstr="Provider=Microsoft.Jet.OLEDB.4.0;datasource="+Server.MapPath("data.mdb");//myconn.ConnectionString=constr;//myconn.Open();//OleDbCommandmycomm=newOleDbCommand();//mycomm.Connection=myconn;//if(DropDownList1.Items[0].Selected)//{//mycomm.CommandText="select*fromglywhere用户名='"+TextBox1.Text+"'and密码='"+TextBox2.Text+"'";//OleDbDataReadermyr;//myr=mycomm.ExecuteReader();//if(myr.Read())//{//Session["用户名"]=myr["用户名"];//Session["密码"]=myr["密码"];//Response.Redirect("chaxun1.aspx");//}}//else//{//Response.Write("<script>alert('登陆失败!');</script>");//}//}//if(DropDownList1.Items[1].Selected)//{//mycomm.CommandText="select*fromt_bmwhere姓名='"+TextBox1.Text+"'and密码='"+TextBox2.Text+"'";//OleDbDataReadermyr;//myr=mycomm.ExecuteReader();//if(myr.Read())//{//Session["姓名"]=myr["姓名"];//Session["密码"]=myr["密码"];//Response.Redirect("chaxun2.aspx");//}//else//{//Response.Write("<script>alert('登陆失败!');</script>");//}//}//}protectedvoidButton1_Click(objectsender,EventArgse)protectedvoidButton1_Click(objectsender,EventArgse){OleDbConnectionmyconn=newOleDbConnection();stringconstr="Provider=Microsoft.Jet.OLEDB.4.0;datasource="+Server.MapPath("data.mdb");myconn.ConnectionString=constr;myconn.Open();OleDbCommandmycomm=newOleDbCommand();mycomm.Connection=myconn;mycomm.CommandText="select*fromzhwherebmh='"+dlm.Text+"'andpwd='"+mm.Text+"'";OleDbDataReadermyr;myr=mycomm.ExecuteReader();if(myr.Read()){stringstr2="selectlx1fromglywherebmh='"+dlm.Text+"'",lx1;myad=newOleDbDataAdapter(str2,constr);myad.Fill(myds,"t_bm");lx1=myds.Tables["t_bm"].Rows[0][0].ToString();Session["bmh"]=myr["bmh"];Session["lx1"]=lx1;if(lx1=="1"){Response.Write("<script>alert('登陆成功!');</script>");Response.Write("<script>document.location='xscj.aspx';</script>");}if(lx1=="2"){Response.Write("<script>alert('登陆成功!');</script>");Response.Write("<script>document.location='gly.aspx';</script>");}//if(lx1=="3")//{//Response.Write("<script>alert('登陆成功!');</script>");//Response.Write("<script>document.location='chaxun3.aspx';</script>");//}}else{Response.Write("<script>alert('登陆失败!报名号或者密码不正确!');window.history.back();</script>");}}publicOleDbDataAdaptermyad{get;set;}publicDataTablemyds{get;set;}}这个是全部的代码,运行的时候提示错误“System.Data.DataTable”不包含“Tables”的定义,并且找不到可接受类型为“System.Data.DataTable”的第一个参数的扩展方法“Tables”(是否缺少using指令或程序集引用?)I:老师原件ACCSS-副本dl.aspx.cs11020I:老师原件ACCSS-副本怎么解决呢

解决方案

解决方案二:
myad.Fill(myds,"t_bm");这里有t_bm表不?你可以myad.Fill(myds);x1=myds.Tables[0].Rows[0][0].ToString();
解决方案三:
DataTablemyds你这个myds是个DataTable啊,不是应该定义成DataSet吗???
解决方案四:
如果你非要定义成DataTable,调用的时候应该这样myds.Rows[0][0].ToString();

时间: 2024-09-18 06:13:03

找大神帮忙这个错误怎么解决呢?的相关文章

图片-求大神解答这个错误如何解决

问题描述 求大神解答这个错误如何解决 解决方案 数据库的密码是否正确,访问被拒绝,root用户密码不对.

在ubuntu 里用bluefish时 建立命令出错不能打开浏览器查看 大神帮忙看一下怎样解决。

问题描述 在ubuntu 里用bluefish时 建立命令出错不能打开浏览器查看 大神帮忙看一下怎样解决. 解决方案 问一下你怎么处理的,我新手,不会弄

请大神帮忙这么挫怎么解决

问题描述 Exceptioninthread"main"java.lang.NoClassDefFoundError:org.apache.commons.logging.LogFactoryatorg.apache.axis.components.logger.LogFactory.class$(LogFactory.java:45)atorg.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45)atja

我的asp.net界面打开后有很多不是我写的请求是什么回事,请大神帮忙看看该怎么解决

问题描述 后边这个一直在发送--,请解决!! 解决方案 解决方案二:导入的第三方类库也可能发送请求的,你要定位到是哪个js文件发送的才能搞清楚

求大神 解答这个错误 怎么解决!!

问题描述 Errorsettingexpression'prd.deal.action'withvalue'[Ljava.lang.String;@5b57846' 解决方案 解决方案二:数据类型问题错误,根据提示检查一下类型,应该不能是String.解决方案三:如果'prd.deal.action'是这整形,而前端传的是空字符就会出问题解决方案四:action属性不是String[]数组

javaweb-求大神帮忙解决。tomcat500错误,具体如下,万分感谢!!

问题描述 求大神帮忙解决.tomcat500错误,具体如下,万分感谢!! type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception java.io.FileNotFoundException: Template /found_res/user_base/fcqc_com

spring mvc-maven+springmvc 报错,找了一下午没解决。哪位大神帮忙看看。

问题描述 maven+springmvc 报错,找了一下午没解决.哪位大神帮忙看看. SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener at org.ap

实时调试- 电脑一开机就跳出对话框显示.NET FRAMWORK出现错误, 急求大神帮忙解决!

问题描述 电脑一开机就跳出对话框显示.NET FRAMWORK出现错误, 急求大神帮忙解决! 电脑原本没这个问题,昨天卸载了一些如土豆视频之类的应用软件后就出现了此问题,现在QQ,迅雷等账号都无法登陆,显示登陆超时,但浏览器网页可以打开.我试过将.NET FRAMWORK卸载后重装,问题依然无法解决.错误对话框如下: 解决方案 既然是启动出问题,装个CClear之类的工具,把启动项分批禁用,找出引起问题的那个,删除它. 解决方案二: Microsoft.NET没有安装好或者与是系统Microso

JavaWeb报SQL错误,一直没有得到解决,请大神帮忙

问题描述 JavaWeb报SQL错误,一直没有得到解决,请大神帮忙 错误如下: java.lang.RuntimeException: java.sql.SQLException: Cannot set cid: incompatible types. Query: select * from t_book where 1=1 and cid = ? order by orderBy limit ?,? Parameters: [922E6E2DB04143D39C9DDB26365B3EE8,