错误-值不能为null. [英] Error - Value cannot be null.

查看:117
本文介绍了错误-值不能为null.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

值不能为空.
参数名称:dataSet
说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

异常详细信息:System.ArgumentNullException:值不能为null.
参数名称:dataSet

源错误:


Value cannot be null.
Parameter name: dataSet
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: dataSet

Source Error:


Line 672:        da.Fill(ds,"cv");<br />
Line 673:        da1=new OleDbDataAdapter(sql,con);<br />
Line 674:        da1.Fill(ds1,"cv");<br />
Line 675:		int r=0,r1=0;<br />
Line 676:		DataRow []rs;




我的代码如下所示





My code is given below


s1 = TextBox1.Text.Trim();
        s2 = TextBox2.Text.Trim();
      
        con.Open();
       	string sql = "select * from cv";
       // string sql1 = "select * from cv";
        da=new OleDbDataAdapter(sql,con);
        da.Fill(ds,"cv");
        da1=new OleDbDataAdapter(sql,con);
        da1.Fill(ds1,"cv");
		int r=0,r1=0;
		DataRow []rs;
		DataRow []rs1;
		rs=ds.Tables["cv"].Select("email='" + s1 + "'");
		r=rs.Length;
		rs1=ds1.Tables["cv"].Select("pass='" + s2 + "'");
		r1=rs1.Length;
		   try {       
            if (s1 == "" && s2 == "")
			{
                Label1.Text = "Please enter your Email ID and Password";
			}
            else 
			{
			if (r>0)
			{
			if(r1>0)
			{
                Response.Redirect("account.aspx");
			}
			else
			{
                Label1.Text = "Email ID not registred or Check your Password";
			}
			}
			}
			}
			catch (Exception ex)
			{
			Response.Write(ex.Message);
			}
          con.Close();

推荐答案

我相信应该是您的连接字符串的con为空.确保连接字符串不为空,并且必须有效.

问候,
爱德华
I believe it is the con which is supposed to be your connection string is null. Make sure that connection string is not null and must be valid.

Regards,
Eduard


这篇关于错误-值不能为null.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆