未将对象引用设置到对象的实例
  public List<DataContract.ClinicInCharge.Records_Moneys> Load(int deptid,string listname)
        {
            string sql, err;
            sql = string.Format(@"select deptid,dept_code + dept_name as listname 
                       from {0} where isuse=1 and duty=1 ", Tables.tbDeptList);
            sql += " order by dept_code";

            DataTable dt = SqlHelper.QueryFromDatabase(ThisConn.sCono, sql, out err);

            SqlHelper.ExecuteSQL(ThisConn.sCono, sql, out err);
            if (err.Length > 0)
            {
                throw new Exception(err);
            }
            return DataConverter.DataTableToIList<DataContract.ClinicInCharge.Records_Moneys>(dt).ToList();

        }


         private void FrmRecords_Money_Load(object sender, EventArgs e)
        {
            try
            {
                string listname = DataConverter.EyeNull(cbodept.SelectedValue);
                entity . deptid = DataConverter.ToInt(cbodept.SelectedValue);
                dal.Load(entity.deptid, listname);
                if (listname !="")
                {
                    if (inputdeptid > 0)//判断是否为财务科?
                    {
                        btnImport.Show();
                        btnsetuser2.Show();
                        btnsetuser.Show();
                        btndelete.Show();
                        btnsave.Show();
                        tabControl1.TabPages.Remove(tabPage3);//使tabControl1不显示
                        tabControl1.TabPages.Remove(tabPage5);
                    }
                    else
                    {
                        btnImport.Hide();
                        btnsetuser2.Hide();
                        btnsetuser.Hide();
                        btndelete.Hide();
                        btnsave.Hide();

                        DataRow r;
                        r = dt.NewRow();
                        r["deptid"] = 0;
                        r["listname"] = "所有";
                        dt.Rows.InsertAt(r, 0);
                    }

                    entity.RecordUser = Share1.user_code + Share1.user_name;
                    DataTable dttime = DataConverter.GetMonthsList(DataConverter.ToDateTime("2018-01-01"), DateTime.Now.Date);
                    cbotime.DataSource = dttime;
                    cbotime.DisplayMember = dttime.Columns["monthsname"].ToString();
                    cbotime.ValueMember = dttime.Columns["months"].ToString();
                    cbotime.SelectedValue = DateTime.Now.AddMonths(-2).ToString("yyyy-MM-01");//两个月之内的记录

                    cbodept.DataSource = dt;
                    cbodept.DisplayMember = dt.Columns["listname"].ToString();//未将对象引用到实例
                    cbodept.ValueMember = dt.Columns["deptid"].ToString();
                    cbodept.SelectedValue = inputdeptid;


                    bselect = true;
                    btnQuery_Click(sender, e);
                }
                }

            catch (Exception ex)
            {
                ThisHQ.Base.Base.SuMsg(ex.Message);
            }

        }

listname为空要怎么解决?

图片说明
怎么让cbodept控件上面有值?我觉得就是这个的问题

0

7个回答

通过dal获取参数值

0

dt没有初始化罗,没见你的dt在哪里获取的。。

你直接设置列名称不就行了,干嘛还从columns属性获取一次?。。。

                     cbodept.DisplayMember ="listname";
                    cbodept.ValueMember ="deptid";
9
qq_32320747
qq_32320747 我不太懂,要DataTable dtdept= ?怎么写?
一年多之前 回复
showbo
支付宝加好友偷能量挖 回复qq_32320747: new DataTable只是实例化,并没有clumns。。自己要搞清楚dt初始化
一年多之前 回复
qq_32320747
qq_32320747 回复C币出货Q155132206: 你说的不对啊,在LOad里面的那个Datatable的声明是dttime的,在全局我有一个 DataTable dt = new DataTable();变量了,
一年多之前 回复
showbo
支付宝加好友偷能量挖 回复qq_32320747: 去掉Load中的DataTable申明,直接初始化全局的dt变量
一年多之前 回复
qq_32320747
qq_32320747 回复C币出货Q155132206: 因为那个是cbo控件,要展示在上面的列表上
一年多之前 回复
qq_32320747
qq_32320747 回复C币出货Q155132206: 那应该这么做?
一年多之前 回复
showbo
支付宝加好友偷能量挖 如果dt是全局变量,Load方法中的dt是私有局部变量,那样 FrmRecords_Money_Load中的dt访问不到,不是同一个变量
一年多之前 回复

你这个代码问题很大啊,首先,字符串拼接最好使用StringBuffer,其次做相等比较要用equals 正确写法应该是if (!"".equals(listname))

0
qq_32320747
qq_32320747 我是C#不是JAVA
一年多之前 回复

1)传进来的参数listname为空或者非正常值
2)sql语句查询有问题
一个个排查吧,这个问题不难

0
qq_32320747
qq_32320747 没错啊,我之前说了就是listname为空要怎么解决?其他的我都查过了
一年多之前 回复

图片说明
主要是应该这两个控件没有值吧,我之前也有这个问题,后来成功了就是因为控件有值,这个要怎么操作?

0

sql = string.Format(@"select deptid,dept_code + dept_name as listname
from {0} where isuse=1 and duty=1 ", Tables.tbDeptList);
sql += " order by dept_code";
这里是吧dept_code和dept_name查询的结果作为字符创链接设置到listName,显然是查询的结果有问题,你把这段sql语句复制到数据库中执行的话listName也是空

0
qq_32320747
qq_32320747 没有啊,我试了有depttid和listname
一年多之前 回复

图片说明

0

俩种可能
1)code和name数据类型不一致 不过这种可能应该排除
2)字符串连接操作在开发工具中存在问题。
你可以这样
sql = string.Format(@"select deptid,dept_code as listname
from {0} where isuse=1 and duty=1 ", Tables.tbDeptList);
sql += " order by dept_code";
看看listname是否还是为空
3)如果1,2都没有问题 那么就是
DataTable dt = SqlHelper.QueryFromDatabase(ThisConn.sCono, sql, out err);

        SqlHelper.ExecuteSQL(ThisConn.sCono, sql, out err);

也就是说与数据库交互的部分的问题
4)暂时没想到

0
qq_32320747
qq_32320747 12没有问题,数据库交互出现什么问题?
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
未将对象引用设置到对象的实例。
我在一个页面定义一个DataTable表 里面已经有数据,把他传到用户控件的后天代码?我是这样写的,为什么老是报出未将对象引用设置到对象的实例。难道穿过来的表是空的吗?[img=https://img-bbs.csdn.net/upload/201404/23/1398214107_854588.jpg][/img][img=https://img-bbs.csdn.net/upload/201404/23/1398214118_325346.jpg][/img][img=https://img-bbs.csdn.net/upload/201404/23/1398214129_620204.jpg][/img]
未将对象引用设置到对象的实例???
private void 音乐试听ToolStripMenuItem_Click(object sender, EventArgs e)rn rn Frm_YinYue x = new Frm_YinYue();rn x.ShowDialog();//就是这里出现问题的rn rn rn 下面的这是Frm_YinYuernrn public partial class Frm_YinYue : Formrn rn //申明一个字符串数组来储存歌曲的地址rn private string[] urlname = new string[2000];rn WMPLib.IWMPMediaCollection mediacollection;rn WMPLib.IWMPMedia media;rnrn //添加单个地址上的mp3文件rnrn private void Addfile(string path)rn rn string songname = path.Substring(path.LastIndexOf('\\') + 1);rn songname = songname.Substring(0, songname.Length - 4);rn mediacollection = axWindowsMediaPlayer1.mediaCollection;rn media = mediacollection.add(path);rn axWindowsMediaPlayer1.currentPlaylist.appendItem(media);rn mediacollection.remove(media, false);rn listBox1.Items.Add(songname);rn urlname[listBox1.Items.Count - 1] = path;rn rnrn public Frm_YinYue()rn rn InitializeComponent();rn rnrn private void 打开文件ToolStripMenuItem_Click(object sender, EventArgs e)rn rn tryrn rn DialogResult result = openFileDialog1.ShowDialog();rn if (result == DialogResult.OK)rn rnrn //songname为歌曲名rn string songname = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf("\\") + 1);rn songname = songname.Substring(0, songname.Length - 1);rn //刷新当前播放的列表rn axWindowsMediaPlayer1.currentPlaylist.clear();rn //同步刷新listBoxrn listBox1.Items.Clear();rn axWindowsMediaPlayer1.URL = openFileDialog1.FileName;rn this.Text = songname + "--Windows Media Player";rn listBox1.Items.Add(songname);rn urlname[listBox1.Items.Count - 1] = openFileDialog1.FileName;rn //播放当前打开的曲目rn axWindowsMediaPlayer1.Ctlcontrols.play();rnrn rnrn rn catch (Exception error)rn rn MessageBox.Show(error.Message.ToString());rn rn rnrn private void 删除文件ToolStripMenuItem_Click(object sender, EventArgs e)rn rn //listBox1.Items.Clear();//这里的是清除listbox中的所有内容rn listBox1.Items.Remove(listBox1.SelectedItem.ToString ());//此处是删除listbox中选中的项rn // this.axWindowsMediaPlayer1.Ctlcontrols.stop();//停止播放rn rn rnrn private void 关闭ToolStripMenuItem_Click(object sender, EventArgs e)rn rn listBox1.Items.Clear();rn rnrn private void 添加单个文件ToolStripMenuItem_Click(object sender, EventArgs e)rn rn tryrn rn DialogResult result = openFileDialog1.ShowDialog();rn if (result == DialogResult.OK)rn rn this.Addfile(openFileDialog1.FileName);rn urlname[listBox1.Items.Count - 1] = openFileDialog1.FileName;rn //播放当前打开的曲目rn axWindowsMediaPlayer1.Ctlcontrols.play();rnrn rn rn catch (Exception error)rn rn MessageBox.Show(error.Message.ToString());rn rn rn private void 播放rlToolStripMenuItem_Click(object sender, EventArgs e)rn rn if (listBox1.Items.Count > 0)rn rn if (this.listBox1.SelectedItems.Count > 0)rn rn if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPaused)rn rn axWindowsMediaPlayer1.Ctlcontrols.play();rn rn elsern axWindowsMediaPlayer1.Ctlcontrols.pause();rnrn rn rn elsern rn MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);rn rn rnrn private void 上一曲ToolStripMenuItem_Click(object sender, EventArgs e)rn rn tryrn rn if (listBox1.SelectedIndex >= 0)rn listBox1.SelectedIndex = listBox1.SelectedIndex - 1;rn if (listBox1.SelectedIndex < 0)rn rn listBox1.SelectedIndex = listBox1.Items.Count - 1;rn rnrn //这里的代码是:当选择了上一曲后,就立即播放上一曲rnrn WMPLib.IWMPMedia nowmedia = axWindowsMediaPlayer1.currentPlaylist.get_Item(listBox1.SelectedIndex);rn axWindowsMediaPlayer1.Ctlcontrols.playItem(nowmedia);rnrn rn catch (Exception) ;rn rnrn private void 下一曲ToolStripMenuItem_Click(object sender, EventArgs e)rn rn axWindowsMediaPlayer1.Ctlcontrols.next();//这个是系统自带的下一曲方法rnrn tryrn rn if (listBox1.SelectedIndex >= 0)rn listBox1.SelectedIndex = listBox1.SelectedIndex +1;rn if (listBox1.SelectedIndex < 0)rn rn listBox1.SelectedIndex = listBox1.Items.Count +1;rn rnrn //这里的代码是:当选择了上一曲后,就立即播放上一曲rn WMPLib.IWMPMedia nowmedia = axWindowsMediaPlayer1.currentPlaylist.get_Item(listBox1.SelectedIndex);rn axWindowsMediaPlayer1.Ctlcontrols.playItem(nowmedia);rnrn rn catch (Exception) ;rn rnrn rnrn rnrn private void listBox1_DoubleClick(object sender, EventArgs e)rn rn if (listBox1.SelectedIndex > -1)rn rn WMPLib.IWMPMedia nowmedia = axWindowsMediaPlayer1.currentPlaylist.get_Item(listBox1.SelectedIndex);rn axWindowsMediaPlayer1.Ctlcontrols.playItem(nowmedia);rnrn rn rnrn rnrn private void 打开文件ToolStripMenuItem2_Click(object sender, EventArgs e)rn rn 打开文件ToolStripMenuItem_Click(sender, e);rn rnrn private void 上一曲ToolStripMenuItem1_Click(object sender, EventArgs e)rn rn 上一曲ToolStripMenuItem_Click(sender, e);rn rnrn private void 下一曲ToolStripMenuItem1_Click(object sender, EventArgs e)rn rn 下一曲ToolStripMenuItem_Click(sender, e);rn rnrn private void 停止ToolStripMenuItem_Click(object sender, EventArgs e)rn rn axWindowsMediaPlayer1.Ctlcontrols.stop();rn rnrn private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)rn rn DialogResult dr = MessageBox.Show("您确定要退出吗?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);rn if (dr == DialogResult.Yes)rn this.Close();rn elsern return;rn rnrn private void toolStripMenuItem3_Click(object sender, EventArgs e)rn rn 添加单个文件ToolStripMenuItem_Click(sender, e);rn rnrn private void toolStripMenuItem2_Click(object sender, EventArgs e)rn rn listBox1.Items.Remove(listBox1.SelectedItem.ToString());rn rn rn
未将对象引用设置到对象的实例??
未将对象引用设置到对象的实例。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。rnrn源错误: rnrnrn行 24: using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["CarManage"].ConnectionString))rn行 25: rn行 26: using (SqlCommand command = new SqlCommand("insert into UserMessage(UserName,UPassword,UCode,UName,USex,UBir,UMZ,USFZ,UPhone,UBuMen,UAddress,UPerMissions) values('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + this.TextBox4.Text + "','" + this.TextBox9.Text + "'," + this.RadioButtonList1.SelectedValue + ",'" + birthday.Value + "','" + DropDownListNation.Items[this.DropDownListNation.SelectedIndex].Text + "','" + this.TextBox5.Text + "','" + this.TextBox6.Text + "','" + this.bumen.Items[this.DropDownListNation.SelectedIndex].Text + "','" + this.TextBox7.Text + "','" + RadioButtonList2.SelectedItem.Text + "')"))rn行 27: rn行 28: connection.Open();//打开数据库连接rn rnrn源文件: f:\CarManage\Register.aspx.cs 行: 26 rnrn//源文件rnpublic partial class Register : System.Web.UI.Pagernrn protected void Page_Load(object sender, EventArgs e)rn rnrn rn protected void Button1_Click(object sender, EventArgs e)rn rn using (SqlConnection connection = new SqlConnectionrnrn(ConfigurationManager.ConnectionStrings["CarManage"].ConnectionString))rn rn using (SqlCommand command = new SqlCommand("insert into UserMessagernrn(UserName,UPassword,UCode,UName,USex,UBir,UMZ,USFZ,UPhone,UBuMen,UAddress,UPerMissiornrnns) values('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + rnrnthis.TextBox4.Text + "','" + this.TextBox9.Text + "'," + rnrnthis.RadioButtonList1.SelectedValue + ",'" + birthday.Value + "','" + rnrnDropDownListNation.Items[this.DropDownListNation.SelectedIndex].Text + "','" + rnrnthis.TextBox5.Text + "','" + this.TextBox6.Text + "','" + this.bumen.Itemsrnrn[this.DropDownListNation.SelectedIndex].Text + "','" + this.TextBox7.Text + "','" + rnrnRadioButtonList2.SelectedItem.Text + "')"))rn rn connection.Open();rn command.Connection = connection;rn int result = (int)command.ExecuteNonQuery();rn if (result != 0)rn rn JScript.AlertAndRedirect("登录成功!", "Login.aspx"); rnrn rn elsern rn JScript.AlertAndRedirect("登录失败,请重新输入您的用户名和密码!", "#");rn rn rn rn rnrn[color=#FF0000]rn 乞求高手前来赐教[/color]
未将对象引用设置到对象的实例..
我知道这个很简单 ,但是..但是 我百度了好久都不会- -~ rn求解-,-rn private string connectionstring = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;rn protected void Page_Load(object sender, EventArgs e)rn rn if (!IsPostBack)rn rn show();rn rn rn protected void show()rn rn string m_id = Request["m_id"].ToString();rn SqlConnection con = new SqlConnection(connectionstring);rn con.Open();rn string selectmessage = "select * from message where m_id='" + m_id + "'";rn SqlCommand cmd = new SqlCommand(selectmessage, con);rn SqlDataReader dr = cmd.ExecuteReader();rn if (dr.Read())rn rn this.Tbname.Text = dr["m_name"].ToString();rn this.Tbsubject.Text = dr["m_subject"].ToString();rn this.Tbcontent.Text = dr["m_content"].ToString();rn this.TBreplay.Text = dr["m_replay"].ToString();rn rn dr.Close();rn con.Close();rn
未将对象引用设置到对象实例
我是新手 不知道哪出问题了 我看了 有NULL出现 但是不知道怎么改啊 rn 弹出一个对话框 显示"用户代码未处理NullferenceExceotion"rn具体代码如下rnusing System;rnusing System.Data;rnusing System.Configuration;rnusing System.Web;rnusing System.Web.Security;rnusing System.Web.UI;rnusing System.Web.UI.WebControls;rnusing System.Web.UI.WebControls.WebParts;rnusing System.Web.UI.HtmlControls;rnusing System.Web.Configuration;rnusing System.Data.SqlClient;rnrnpublic partial class _Default : System.Web.UI.Page rnrn protected void Page_Load(object sender, EventArgs e)rn rn string connectionString = WebConfigurationManager.ConnectionStrings["Test"].ConnectionString;rn SqlConnection con = new SqlConnection(connectionString);rn string sql = "select * from '操作员信息'";rn SqlCommand cmd = new SqlCommand(sql, con);rn 显示.Text = sql;rn rn protected void Button1_Click(object sender, EventArgs e)rn rnrn rnrn
未将对象引用设置到对象的实例????????????
未将对象引用设置到对象的实例。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。rnrn源错误: rnrnrn行 82:Db AddDb=new Db();rn行 83:string Sql1;rn行 84:Sql1="update Site_Info set SiteName='"+tbxSiteName.Text+"',SiteManager='"+tbxSiteManage.Text+"',"+rn行 85:"SiteUrl='"+tbxSitePwd.Text+"',ManagePwd='"+tbxSitePwd.Text+"' where Id="+Int32.Parse(lblSiteId.Text);rn行 86: if (AddDb.ExeSql(Sql1)==1)rn rnrnrn行 85:显示红色,什么原因啊
未将对象引用设置到对象的实例?
我做了个Repeater的批量删除,rn页面上是这样的rn rn rn rn rn rn rn rn <%#DataBinder.Eval(Container.DataItem,"Id") %>rn <%#DataBinder.Eval(Container.DataItem,"ISBN") %>rn <%#DataBinder.Eval(Container.DataItem,"bookName") %>rn <%#DataBinder.Eval(Container.DataItem,"price") %>rn <%#DataBinder.Eval(Container.DataItem,"number") %>rn <%#DataBinder.Eval(Container.DataItem,"myang") %>rn <%#DataBinder.Eval(Container.DataItem, "bookSpec")%>rn rn rnrn rncs里代码:rnprotected void Button1_Click(object sender, EventArgs e)rn rn //Button1.Attributes["onclick"] = "return confirm('你确实要删除吗?')";rn rn string ID= "";rn foreach (RepeaterItem item in this.Repeater1.Items)rn rn CheckBox ck = (CheckBox)item.FindControl("CheckBox");rn if (ck.Checked)rn rn HtmlInputHidden inputhidden = (HtmlInputHidden)item.FindControl("fieldname ");rn ID += inputhidden.Value.Trim() + ",";rn rn rn if (ID.Length == 0)rn rn this.Page.RegisterStartupScript(" ", " ");rn rn elsern rn ID = ID.Remove(ID.Length - 1, 1);rn Info.DelId = ID;rn Fun fun = new Fun();rn fun.DelshaixuanId();rn Response.Write(" ");rn rn rn rnrnrnrnrn它说我这句话ID += inputhidden.Value.Trim() + ",";rn未将对象引用设置到对象的实例。什么意思啊?
◆未将对象引用设置到对象的实例◆
声明了以下方法用于上传图片.程序开始调试是正常的,可以上传图片,后来我在控件外面加了一个UpdatePanel ,再点Upload上传时,程序执行到下面红颜色一行代码是出现:"未将对象引用设置到对象的实例"错误提示!请教如何解决!!??rn protected void UploadImg_Click(object sender, EventArgs e)rn rn string fullname = File1.FileName.ToString();rn string fn = DateTime.Now.ToString("yyyyMMddHHmmss") + fullname;rn string typ2 = fullname.Substring(fullname.LastIndexOf(".") + 1);rn [color=#FF0000]string size = File1.PostedFile.ContentLength.ToString();[/color]rn if (typ2 == "jpg" || typ2 == "gif")rn rn File1.SaveAs(Server.MapPath("img") + "\\" + fn);rn Response.Write(" ");rn this.ImgUrl.Text = "img/" + fn;rn this.shipPhoto.ImageUrl = "img/" + fn;rn rn elsern rn Response.Write(" ");rn rn
未将对象引用设置到对象的实例!
未将对象引用设置到对象的实例 !rnrn是怎么回事!rnrn
未将对象引用设置到对象的实例 ???
未将对象引用设置到对象的实例。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。rnrn源错误: rnrnrn行 21: private void Page_Load(object sender, System.EventArgs e)rn行 22: rn行 23: string id=Request["Tname"].ToString();rn行 24: string pass=Request["Tpass"].ToString();rn行 25: if(id=="a"&&pass=="a")rn rn
未将对象引用设置到对象的实例??
做搜索时,单击搜索出现未将对象引用设置到对象的实例.什么意思?大家帮忙!rnDim conn As SqlConnectionrn Function GetSearchview() As DataViewrn Dim strvalue As String = Trim("txtSearchstring.text")rn If strvalue <> "" Thenrn strvalue = "%" & strvalue & "%"rn End Ifrn conn = New SqlConnection ("server=wiz02;uid=exam;pwd=exam;database=bookshop")rn Dim mycommand As SqlCommandrnrn Select Case SelCategory.SelectedItem.Valuern Case "title"rn mycommand = New SqlCommand("SearchByTitle", conn)rn mycommand.Parameters.Add(New SqlParameter("@title", SqlDbType.VarChar, 50))rn mycommand.Parameters("@title").Value = strvaluern Case "author"rn mycommand = New SqlCommand("SearchByAuthor", conn)rn mycommand.Parameters.Add(New SqlParameter("@author", SqlDbType.VarChar, 40))rn mycommand.Parameters("@author").Value = strvaluern Case "publisher"rn mycommand = New SqlCommand("SearchByPublisher", conn)rn mycommand.Parameters.Add(New SqlParameter("@publisher", SqlDbType.VarChar, 30))rn mycommand.Parameters("@publisher").Value = strvaluern End Selectrn mycommand.CommandType = CommandType.StoredProcedurern Dim ds As DataSetrn ds = New DataSet()rn Dim adapter As New SqlDataAdapter(mycommand)rn adapter.Fill(ds, "bookstore")rn If ds.Tables("bookstore").Rows.Count > 0 Thenrn Return (ds.Tables("bookstore").DefaultView)rn Elsern Return (Nothing)rn End Ifrn End Functionrn rn Sub data_bind(ByVal dview As DataView, ByVal bindobject As Object)rn bindobject.datasource = dviewrn bindobject.databind()rn End Subrnrn Private Sub btnsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Clickrn Dim dview As DataView = GetSearchview()rn If dview.Count > 0 Thenrn lblResult.Text = "共找到" & dview.Count & "条记录."rn Elsern lblResult.Text = "对不起,没有找到符合条件的记录!"rn End Ifrn Session("Gridview") = dviewrn BookStore.CurrentPageIndex = 0rn data_bind(Session("Gridview"), BookStore)rn End Sub
相关热词 c# 线程顺序 c#昨天当前时间 c# 多进程 锁 c#mysql图片存取 c# ocx 委托事件 c# 读取类的属性和值 c# out 使用限制 c#获取url的id c#怎么进行分页查询 c# update 集合