datareder problem

问题描述

stringstrSelect="select*fromstudentwherestudent_ID='"+tb_studentID.Text+"'";SqlConnectionconn=newSqlConnection(strconn);conn.Open();SqlCommandcmd=newSqlCommand(strSelect,conn);SqlDataReaderdr=cmd.ExecuteReader(CommandBehavior.CloseConnection);while(dr.Read()){this.tb_StuID.Text=dr["student_ID"].ToString();this.tb_StuName.Text=dr["studnet_name"].ToString();this.tb_classID.Text=dr["class_ID"].ToString();this.combo_age.Text=dr["age"].ToString();this.combo_Sex.Text=dr["sex"].ToString();this.combo_specialty.Text=dr["specialty"].ToString();this.photo.Image=Image.FromFile(dr["picture"].ToString());this.combo_department.Text=dr["department_name"].ToString();this.combo_politic.Text=dr["politic"].ToString();}结果:未处理System.InvalidOperationExceptionMessage="在没有任何数据时进行无效的读取尝试。"请高手指点迷津!!

时间: 2024-12-05 22:48:52

datareder problem的相关文章

ZOJ Problem Set - 3713

题意:给定一个字符串,用字符串ASC2码16进制数输出 ,并在前面输出字符串长度的16进制,输出长度的规则是 先输出长度的二进制数的后七位的十六进制(如果左边还有1 则这在后七位前面加上个1再输出  然后二进制数右移动七位,直到左边没有1)   注:所有16数都必须为两位! 解题思路:对长度进行输出处理 解题代码: #include<stdio.h> #include<string.h> #include<stdlib.h> #include<time.h>

A problem when connect MSSQL with transaction.

Problem: Could not load object: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode. =============================================== Solve: If you pass "SelectMethod=cursor" attribute in co

Fetching Across Commits: Where Is the Source of the Problem?

Fetching Across Commits: Where Is the Source of the Problem? By Boris Milrud Fetching across commits is a common and accepted practice in the Oracle programming world. However, it is not an ANSI-supported operation. According to the ANSI standard, a

Excel:there was a problem sending the command to the program

症状:同事开Excel的时候,弹出错误提示框提示:There was a problem sending the command to the program,如图: 原因:不详 解决方法:baidu了下,发现是注册表的问题,找到如下key值:HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\ ,将下面的文件夹:Excel改个名字就好了. 查看本栏目更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.c

Geeks面试题:Box Stacking Problem

Dynamic Programming | Set 22 (Box Stacking Problem) You are given a set of n types of rectangular 3-D boxes, where the i^th box has height h(i), width w(i) and depth d(i) (all real numbers). You want to create a stack of boxes which is as tall as pos

VS2012的There was a problem sending the command to the program问题

版本:VS2012 Express 问题现象 安装Visual Studio 2012 Express之后,双击打开web.config文件时经常出现"There was a problem sending the command to the program"的错误,然后VS2012 Express打开了,但web.config文件没打开,需要再次双击web.config文件才能打开.很是烦人. 出现条件 问题出现在双击web.config文件时第一次启动VS2012 Express

IOConsole updater has encounter a problem问题

你是否也遇到过 "IOConsole updater" has encounter a problem 问题? Windows->Preferences->Run/Debug->Console 将console输出设为 为无限制行或者最大限制行,那么在内存紧张的情况下,上面问题就会出现.大家调试程序 时经常会做这个设置查看应用输出,但事后就忘记关闭了,所以过段时间后就会出现 IOConsole Updater问题,然后一头雾水. 解铃还须系铃人,问题的解决就是取消 C

Excel 2007提示:There was a problem sending the command to the program

症状:用户打开任何Excel文件都弹出这个错误提示:There was a problem sending the command to the program,如图: 原因:设置及软件冲突 解决方法:试了重装office都不行.最后google找到方法.进Excel Option--Advanced--General--Ignore other applications that use Dynamic Data Exchange (DDE)" is not checked(去掉这一项前面的勾

UVa 10026:Shoemaker&#039;s Problem

链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=967 类型: 贪心 原题: Shoemaker has N jobs (orders from customers) which he must make. Shoemaker can work on only one job in each day.