并非所有的代码路径都返回值? [问题点数:20分,结帖人feifeiyaqi2]

Bbs1
本版专家分:14
结帖率 80%
Bbs1
本版专家分:14
Bbs5
本版专家分:3431
Bbs2
本版专家分:236
Bbs5
本版专家分:2909
Bbs10
本版专家分:123633
Blank
进士 2008年 总版技术专家分年内排行榜第十
Blank
金牌 2007年5月 总版技术专家分月排行榜第一
Blank
银牌 2008年6月 总版技术专家分月排行榜第二
2007年6月 总版技术专家分月排行榜第二
Blank
微软MVP 2010年10月 荣获微软MVP称号
2008年10月 荣获微软MVP称号
并非有的代码路径返回值??
错误:<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rnprotected bool checked_eid()rn rn bool check_id = false;rn string emp_id = Session["EmployeeID"].ToString();rn int rid = Convert.ToInt32(Request.QueryString["id"]);rn DataSet ds_eid = af.find_isok(rid);rn if (ds_eid.Tables[0].Rows.Count > 0)rn rn ArrayList list = new ArrayList();rn for (int i = 0; i < ds_eid.Tables[0].Rows.Count; i++)rn rn list.Add(ds_eid.Tables[0].Rows[i][1]);rn rn for (int j = 0; j < list.Count; j++)rn rn string emp = list[j].ToString();rn if (emp == emp_id)rn rn return check_id=true;rn rn rn rn elsern rn return check_id=false;rn rn ds_eid.Dispose();rn rn
并非有的路径返回值
public SqlDataReader GetDataSetByStr(string str)rn rn tryrn rn objSqlCon.Open();rn objSqlCom = new SqlCommand(str, objSqlCon);rn objSqlCom.CommandType = CommandType.Text;rn objSqlDataReader = objSqlCom.ExecuteReader();rn return objSqlDataReader;rn catch (Exception e2)rn rn Console.WriteLine(e2.Message);rn rn finally rn rn if (objSqlCon != null)rn rn objSqlCon.Close();rn rn rn rnrnrn错误提示:BookManage。DataAccess.GetDataSetByStr(string ) <em>并非</em>所<em>有的</em><em>路径</em>都<em>返回值</em>
并非有的路径代码都有返回值
[code=C#]rnusing System;rnusing System.Collections.Generic;rnusing System.Linq;rnusing System.Text;rnrnnamespace TestIndexrnrn public class SpellStringrn rn protected string[] theString=new string[10];rn public SpellString()rn rn for (int i = 0; i < 10; i++)rn rnrnrn Console.WriteLine(theString[i]);rn rnrn rn public string this[int index]rn rn getrn rnrn if (index < 0 || index >= 10)rn rnrn //错误处理rn rn elsern return theString[index];rnrn rn setrn rnrn if (index < 0 || index >= 10)rn rnrn //错误处理rn rn elsern theString[index] = value;rn rnrn rn rnrn rn public class Programrn rn static void Main(string[] args)rn rn SpellString thisString = new SpellString();rn thisString[2] = "HEllo";rn thisString[3] = "world";rn for (int i=0;i,i,thisString[i]);rn rn rn rnrnrn[/code]rnrn提示get行错误。<em>并非</em>所有<em>代码</em>都有<em>返回值</em>
并非有的代码路径都有返回值
我用[color=#FF0000]csc HelloWorld.exe[/color]编译的时候不能通过,说是“[color=#FF0000]<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都有<em>返回值</em>[/color]”,是哪里出错了,该怎么修改呢?rn谢谢了rnrn[code=C#]rnusing System;rnusing System.Collections.Generic;rnusing System.Text;rnrnnamespace HelloWorldrnrn class Programrn rn public static long getx(int x) //阶乘 (注:使用Static定义的方法不用实例化就能使用)rn rn long y = 1;rn for (int i = 2; i< 1 )rn rn Console.WriteLine("输入参数不能小于1");rn rn elsern rn int x; long y,z;rn tryrn rn x = Convert.ToInt32(args[0]);rn y = getx(x);rn z = gety(x);rn Console.WriteLine(x + "的阶乘为: " + y);rn Console.WriteLine(x + "的阶加为: " + z);rn return 1; //返回1表示调用程序成功执行rn rn catch(Exception ex)rn rn Console.WriteLine(ex.ToString());rn rn rn rn rnrnrn[/code]
并非有的代码路径返回值
一个根据用户名得到密码的函数:rnprivate string getdbsalt(string supplyloginname)rn rn rn rn SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings ["constr"]);rnrn SqlCommand cmd = new SqlCommand("jsjlookupuser", conn );rn cmd.CommandType = CommandType.StoredProcedure;rnrn SqlParameter sqlParam = cmd.Parameters.Add("@loginname", SqlDbType.NVarChar,50);rn sqlParam.Value =supplyloginname;rn tryrn rn conn.Open();rn SqlDataReader reader = cmd.ExecuteReader();rn reader.Read(); // 前进到唯一的行rn // 从返回的数据流中返回输出参数rn // string dbPasswordHash = reader.GetString(0);rn string salt = reader.GetString(1);rn rn reader.Close();rnrn return salt ;rn rn rn rn rn catch (Exception ex)rn rn Label1.Text =ex.ToString ();rn rn finallyrn rn rn conn.Close();rn rn rn rn rnrn为什么报<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>有<em>返回值</em>的错,我都写了return salt ;rn是什么原因
新手 求高手 并非有的代码路径返回值
public TreeNode getNode_byLevelOne(string text)rn rn rn foreach (TreeNode node in this.Nodes)rn rn if ((node.Text.ToString().Trim()).ToLower() == (text.Trim().ToString()).ToLower())rn rn return node;rn rn rn rn rnrn错误 <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em> rnrn我只知道 少了<em>返回值</em> 就是不知道 如何修改<em>代码</em> 求高手
错误:并非有的代码路径返回值
各位前辈 小弟用C#编写了如下<em>代码</em>:rnusing System;rnusing System.Collections.Generic;rnusing System.Text;rnrnnamespace ConsoleApplication1rnrn class Programrn rn public static bool asdf()rn rn for ( int i = 0 ; i < 30 ; i++ )rn rn if ( i == 29 )rn return true;rn elsern return false;rn rn rn static void Main( string[] args )rn rnrn asdf();rn Console.ReadKey();rn rn rnrnrn结果提示 错误“ConsoleApplication1.Program.asdf()”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn俺知道这意思说 俺自定义的函数asdf() 有个别情况没有设<em>返回值</em> 但是各位请看上面的<em>代码</em> 可返回的情况应该已经考虑全面了才对呀 除了满足if返回true之外 其他情况都返回falsernrn这段<em>代码</em>是俺编程时发现这个问题后 特意编这段简单的<em>代码</em>来测试的 俺发现把用if判断返回情况嵌套到for循环里就会出现这种情况 如果把for注释掉 只留下if else这几行 程序可以正常运行rnrn俺用C++编了同样的<em>代码</em>进行测试 结果却是正常通过 而且<em>返回值</em>也是正确的rn俺使用的是 visual studio 2005rnrn有前辈知道到底是什么原因么???
新手求解,并非有的代码路径返回值
public bool ExistProduct(DataTable cart)rnrn string sqlconnstr = ConfigurationManager.ConnectionStrings["ConnetionString"].ConnectionString;rn SqlConnection sqlconn = new SqlConnection(sqlconnstr);rn SqlCommand sqlcommand = new SqlCommand();rn sqlcommand.Connection = sqlconn;rn sqlconn.Open();rn sqlcommand.CommandText = "select * from Product";rn SqlDataReader sqldatareader = sqlcommand.ExecuteReader();rn while (sqldatareader.Read())rn rn foreach (DataRow dr in cart.Rows)rn rn if (dr["ProductName"].ToString().Equals(sqldatareader.GetString(1)))rn //若购物车中存在用户要购买的商品,则商品数量+1rn dr["Number"] = Convert.ToInt32(dr["Number"]) + 1;rn //将购物车保存到Session["Cart"]中rn Session["Cart"] = cart;rn Response.Redirect("");rn rn rn return true;rn rn sqlcommand = null;rn sqlconn.Close();rn sqlconn = null;rnrnrn提示错误 “ ExistProduct(System.Data.DataTable)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn是什么原因怎么改呢?
请教,错误:并非有的代码路径返回值
错误 1 “UserDao.GetLogin()”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn请问如何修改?rnpublic bool GetLogin()rn rn SqlConnection con = null;rn tryrn rn con = new SqlConnection(cs);rn SqlCommand cmd = con.CreateCommand();rn con.Open();rn cmd.CommandType = CommandType.StoredProcedure;rn cmd.CommandText = "WEB_Login";rn cmd.Parameters.Add("@userName", SqlDbType.VarChar, 50).Value = user.UserName;rn cmd.Parameters.Add("@userPwd", SqlDbType.VarChar, 50).Value = user.UserPwd;rn object o = cmd.ExecuteScalar();rn if (o != null)rn rn int iCount = Int32.Parse(o.ToString());rn if (iCount == 0)rn rn return true;rn rn elsern rn return false;rn rn rn rn finallyrn rn if (con != null)rn rn con.Close();rn rn rn
并非有的代码路径返回值(在线等!)
这是什么意思呀?<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>
求助 错误:并非有的代码路径返回值
PublicMethod.ChangeFilePhy(string, string, string)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em><em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rnrn出错的是这句public string ChangeFilePhy(string fileName, string playFile, string imgFile)rnrn看到这句话 我第一反应就是 我这三个string fileName, string playFile, string imgFile没有返回,但是我的确有写返回,所以我不知道错在哪了,请各位指点我一下 附上<em>代码</em> rnDefault.aspx.csrn[code=csharp]using 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.IO;rnpublic partial class _Default : System.Web.UI.Pagernrn // 扩展名定义rn string[] strArrFfmpeg = new string[] "asf", "avi", "mpg", "3gp", "mov" ;rn string[] strArrMencoder = new string[] "wmv", "rm", "rmvb" ;rn protected void Page_Load(object sender, EventArgs e)rn rn rn //rn protected void btnUpload_Click(object sender, EventArgs e)rn rn string upFileName = "";rn if (this.FileUpload1.HasFile)rn rn string fileName = PublicMethod.GetFileName(this.FileUpload1.FileName);// GetFileName();rn if ((string)Session["file"] == fileName)rn rn return;rn rn upFileName = Server.MapPath(PublicMethod.upFile + fileName);rn this.FileUpload1.SaveAs(upFileName);rn string saveName = DateTime.Now.ToString("yyyyMMddHHmmssffff");rn string playFile = Server.MapPath(PublicMethod.playFile + saveName);rn string imgFile = Server.MapPath(PublicMethod.imgFile + saveName);rn //System.IO.File.Copy(Server.MapPath(PublicMethod.playFile + "00000002.jpg"), Server.MapPath(PublicMethod.imgFile+"aa.jpg"));rn PublicMethod pm = new PublicMethod();rn string m_strExtension = PublicMethod.GetExtension(this.FileUpload1.PostedFile.FileName).ToLower();rn if (m_strExtension == "flv")rn //直接拷贝到播放文件夹下rn System.IO.File.Copy(upFileName, playFile + ".flv");rn pm.CatchImg(upFileName, imgFile);rn rn string Extension = CheckExtension(m_strExtension);rn if (Extension == "ffmpeg")rn rn pm.ChangeFilePhy(upFileName,playFile,imgFile);rn rn /* else if (Extension == "mencoder")rn rn pm.MChangeFilePhy(upFileName, playFile, imgFile);rn rn InsertData(this.txtTitle.Text, fileName, saveName);*/rn Session["file"] = fileName;rn rn rn //rn private string CheckExtension(string extension)rn rn string m_strReturn = "";rn foreach (string var in this.strArrFfmpeg)rn rn if (var == extension)rn rn m_strReturn = "ffmpeg"; break;rn rn rn /* if (m_strReturn == "")rn rn foreach (string var in strArrMencoder)rn rn if (var == extension)rn rn m_strReturn = "mencoder"; break;rn rn rn */rn return m_strReturn;rn rnrn[/code]rnrnPublicMethod.csrn[code=csharp]rnusing System;rnusing System.Data;rnusing System.Configuration;rnusing System.Linq;rnusing System.Web;rnusing System.Web.Security;rnusing System.Web.UI;rnusing System.Web.UI.HtmlControls;rnusing System.Web.UI.WebControls;rnusing System.Web.UI.WebControls.WebParts;rnusing System.Xml.Linq;rnusing System.IO;rnusing System.Diagnostics;rnrn/// rn///PublicMethod 的摘要说明rn/// rnpublic class PublicMethodrnrn public PublicMethod()rn rn //rn //TODO: 在此处添加构造函数逻辑rn //rn rn public static string ffmpegtool = ConfigurationManager.AppSettings["ffmpeg"];rn public static string mencodertool = ConfigurationManager.AppSettings["mencoder"];rn public static string mplayertool = ConfigurationManager.AppSettings["mplayer"];rn public static string upFile = ConfigurationManager.AppSettings["upfile"] + "/";rn public static string imgFile = ConfigurationManager.AppSettings["imgfile"] + "/";rn public static string playFile = ConfigurationManager.AppSettings["playfile"] + "/";rn //文件图片大小rn public static string sizeOfImg = ConfigurationManager.AppSettings["CatchFlvImgSize"];rn //文件大小rn public static string widthOfFile = ConfigurationManager.AppSettings["widthSize"];rn public static string heightOfFile = ConfigurationManager.AppSettings["heightSize"];rn // // //获取文件的名字rn public static string GetFileName(string fileName)rn rn int i = fileName.LastIndexOf("\\") + 1;rn string Name = fileName.Substring(i);rn return Name;rn rn //获取文件扩展名rn public static string GetExtension(string fileName)rn rn int i = fileName.LastIndexOf(".") + 1;rn string Name = fileName.Substring(i);rn return Name;rn rn //rn #region //运行FFMpeg的视频解码,(这里是绝对<em>路径</em>)rn /// rn /// 转换文件并保存在指定文件夹下面(这里是绝对<em>路径</em>)rn /// rn /// 上传视频文件的<em>路径</em>(原文件)rn /// 转换后的文件的<em>路径</em>(网络播放文件)rn /// 从视频文件中抓取的图片<em>路径</em>rn /// 成功:返回图片虚拟地址; 失败:返回空字符串rn public string ChangeFilePhy(string fileName, string playFile, string imgFile)rn rn string ffmpeg = System.Web.HttpContext.Current.Server.MapPath(PublicMethod.ffmpegtool);rn if ((!System.IO.File.Exists(ffmpeg)) || (!System.IO.File.Exists(fileName)))rn rn return "";rn rn //获得图片和(.flv)文件相对<em>路径</em>/最后存储到数据库的<em>路径</em>,如:/Web/User1/00001.jpg rn // string flv_file = System.IO.Path.ChangeExtension(playFile, ".flv");rnrn //截图的尺寸大小,配置在Web.Config中,如: rnrnrn string filename = TransferVedio(upFile, playFile);rnrn string smallpic = CatchImg(upFile, imgFile);rnrnrn rnrn public string TransferVedio(string upFileName, string playFile)rn rn string ffmpeg = System.Web.HttpContext.Current.Server.MapPath(PublicMethod.ffmpegtool);rn string flv_file = System.IO.Path.ChangeExtension(playFile, ".flv");rnrn //截图的尺寸大小,配置在Web.Config中,如: rn //string FlvImgSize = VedioConvert.sizeOfImg;rnrn Process p = new Process();//建立外部调用线程 rn p.StartInfo.FileName = ffmpeg;//要调用外部程序的绝对<em>路径</em> rn p.StartInfo.Arguments = " -i " + "\"" + upFileName + "\"" + " -ab 56 -ar 22050 -b 500 -r 15 -s " + widthOfFile + "x" + heightOfFile + " " + "\"" + flv_file + "\"";rnrn p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动线程(一定为FALSE,详细的请看MSDN) rn p.StartInfo.RedirectStandardError = true;//把外部程序错误输出写到StandardError流中(这个一定要注意,FFMPEG的所有输出信息,都为错误输出流,用StandardOutput是捕获不到任何消息的...这是我耗费了2个多月得出来的经验...mencoder就是用standardOutput来捕获的) rn p.StartInfo.CreateNoWindow = true;//不创建进程窗口 rn //p.ErrorDataReceived += new DataReceivedEventHandler(Output);//外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN rn p.Start();//启动线程 rn p.BeginErrorReadLine();//开始异步读取 rn p.WaitForExit();//阻塞等待进程结束 rn p.Close();//关闭进程 rn p.Dispose();//释放资源 rnrnrn if (System.IO.File.Exists(flv_file) && new FileInfo(flv_file).Length > 0)rn rn return flv_file.Substring(flv_file.LastIndexOf("\\") + 1);rn rn elsern rn return "";rn rnrnrn rnrn public string CatchImg(string fileName, string imgFile)rn rn string ffmpeg = System.Web.HttpContext.Current.Server.MapPath(PublicMethod.ffmpegtool);rn string flv_img = imgFile + ".jpg";rn string FlvImgSize = VedioConvert.sizeOfImg;rnrnrn Process p = new Process();//建立外部调用线程 rn p.StartInfo.FileName = ffmpeg;//要调用外部程序的绝对<em>路径</em> rn p.StartInfo.Arguments = @"-i " + "\"" + fileName + "\"" + " -y -f image2 -ss 08.010 -t 0.001 -s 352x240 " + "\"" + flv_img + "\"";rnrn p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动线程(一定为FALSE,详细的请看MSDN) rn p.StartInfo.RedirectStandardError = true;//把外部程序错误输出写到StandardError流中(这个一定要注意,FFMPEG的所有输出信息,都为错误输出流,用StandardOutput是捕获不到任何消息的...这是我耗费了2个多月得出来的经验...mencoder就是用standardOutput来捕获的) rn p.StartInfo.CreateNoWindow = true;//不创建进程窗口 rn //p.ErrorDataReceived += new DataReceivedEventHandler(Output);//外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN rn p.Start();//启动线程 rn p.BeginErrorReadLine();//开始异步读取 rn p.WaitForExit();//阻塞等待进程结束 rn p.Close();//关闭进程 rn p.Dispose();//释放资源rnrnrn if (System.IO.File.Exists(flv_img) && new FileInfo(flv_img).Length > 0)rn rn return flv_img.Substring(flv_img.LastIndexOf("\\") + 1);rn rn elsern rn return "";rn rnrnrn rnrn rnrn #endregionrnrnrn[/code]rnrn
并非所有的代码路径返回值"">提示:"并非有的代码路径返回值"
运行时提示:"<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>" 不知道什么原因?请告诉给予帮助?谢谢!rnprivate User LoadOrder(SqlDataReader reader)rn rn tryrn rn User user = new User();rn user.UserId = Convert.ToInt32(reader["UserID"]); rn rn return user;rn rn catch (Exception e)rn rn e.ToString();rn rn rn//====================rn public class Userrn rn private int m_UserId;rn public User()rn rn //rn // TODO: Add constructor logic herern //rn rnrn public int UserIdrn rn get return m_UserId; rn set m_UserId = value; rn rn
并非有的代码路径返回值.程序应该怎么改?
[code=C#][/code]rn public int CheckUser()rn rn if (this.tbxUserName.Text == "")rn rn MessageBox.Show("用户名不能为空!", "错误");rn rn else if (this.tbxPassWord.Text == "")rn rn MessageBox.Show("密码不能为空!", "错误");rn rn elsern rn string str = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];rn SqlConnection conn = new SqlConnection(str);rn SqlCommand cmd = new SqlCommand("Login", conn);rnrn cmd.CommandType = CommandType.StoredProcedure;rn SqlParameter UserName = new SqlParameter("@username", SqlDbType.VarChar, 50);rn UserName.Value = this.tbxUserName.Text;rn cmd.Parameters.Add(UserName);rnrn SqlParameter PassWord = new SqlParameter("@pwd", SqlDbType.VarChar, 50);rn UserName.Value = this.tbxPassWord.Text;rn cmd.Parameters.Add(PassWord);rnrn SqlParameter sp = new SqlParameter("@return", SqlDbType.Int, 4);rnrn sp.Direction = ParameterDirection.Output;rn cmd.Parameters.Add(sp);rnrn tryrn rn conn.Open();rn cmd.ExecuteNonQuery();rn conn.Close();rn int n = (int)(sp.Value);rn return n;rn rn catchrn rn return 0;rn rn rn rn private void button1_Click(object sender, EventArgs e)rn rn if (CheckUser() > 0)rn rn PicManager pic = new PicManager();rn pic.Show();rn this.Hide();rn rn elsern rn MessageBox.Show("用户名不能为空");rn rn
CS0161: “UpdatingDBDirectly.GetSelectedRecord()”: 并非有的代码路径返回值
下面是问题所在相关<em>代码</em>,请各位大侠帮分析分析!rnprotected void btnEdit_Click( object sender, EventArgs e)rn rn int shipperID = GetSelectedRecord();rn string cmd = @"Update Shippers set CompanyName = '" +rn this.txtName.Text +rn "', Phone ='" + this.txtPhone.Text + "' where ShipperID = " + shipperID;rn UpdateDB(cmd);rn PopulateGrid();rn rn rn protected int GetSelectedRecord()rn rn int shipperID = -1;rn int index = GridView1.SelectedIndex;rn if (index != -1)rn rn DataKey key = GridView1.DataKeys[index];rn shipperID = (int)key.Value;rn return shipperID;rn rn rn protected void btnDelete_Click(object sender, EventArgs e)rn rn string cmd = @"delete from Shippers where ShipperID =" + GetSelectedRecord();rnrn UpdateDB(cmd);rn PopulateGrid();rn
C# 错误 并非有的代码路径返回值
namespace WindowsFormsApplication1rnrn public partial class Form1 : Formrn rn string aaa = "";rn public Form1()rn rnrn InitializeComponent();rn rn rnrnrnrn public class bdMsgVerifyCodern rn public string vcToken get; set; //genimg字符rn public Image vcImg get; set; //验证码图片rnrnrn public static bdMsgVerifyCode Create(string cookie)rn rn bdMsgVerifyCode vc = new bdMsgVerifyCode();rn WebClient client = new WebClient();rn client.Headers.Add(HttpRequestHeader.Cookie, cookie);rn client.Headers.Add(HttpRequestHeader.Referer, "http://hi.baidu.com/msg/index?from=redirect&ct=21&cm=1&tn=bmSendMessage&un=");rn string html = client.DownloadString("http://hi.baidu.com/sys/file/getvcode?echoback=getVcodeDone&callback=bd__cbs__tppotb");rn int start = html.IndexOf("\"") + 1;rn int end = html.IndexOf("\"", start);rn vc.vcToken = html.Substring(start, end - start);rnrn byte[] imgbuf = client.DownloadData("http://hiup.baidu.com/cgi-bin/genimg?" + vc.vcToken);rn MemoryStream ms = new MemoryStream(imgbuf);rn vc.vcImg = Image.FromStream(ms);rn ms.Close();rn return vc;rn rn rn private void button1_Click(object sender, EventArgs e)rn rn bdMsgVerifyCode vc = bdMsgVerifyCode.Create("OPENPLATFORM_SP=cd9ea067da03_1297859249; BAIDUID=26D7E772BCC06F88A642088CC00B4584:FG=1; BDUSS=lEaW1pWG4zNTlWdWFabTM0REl2QlV6dTVhZzZ5QTQ4fmxBdmgwMGVLVVRTSU5OQVFBQUFBJCQAAAAAAAAAAAoakSd28J0KtrzLtc7Sz~HJ8b6tsqEAAAAAAAAAAAAAAAAAAAAAAADA2gV8AAAAAMDaBXwAAAAAuFNCAAAAAAAxMC4yMy4yNBO7W00Tu1tNaD; USERID=f5a7193b428710f975e52280af974cbdf14a; IM_old=0|gk8di8w0; _ML_ST=10%7Cgk88mm47");rn pictureBox1.Image = vc.vcImg;rn aaa = vc.vcToken;rnrn rn string Post(string url, string postdata)rn rn WebClient client = new WebClient();//实例化rn client.Encoding = Encoding.GetEncoding("gb2312");//设编码rn client.Headers.Add(HttpRequestHeader.Cookie, "BDUSS=3V1N1FFUzZONzczMHNXTFllR2dmbXBXSUFsfnRLZkE3eWZyNnVCSWgtcE5yNFJOQVFBQUFBJCQAAAAAAAAAAApRLgt28J0KtrzLtc7Sz~HJ8b6tsqEAAAAAAAAAAAAAAAAAAAAAAADA-kRzAAAAAMD6RHMAAAAAuFNCAAAAAAAxMC4yMy4yNE0iXU1NIl1NQ; BAIDUID=9F9ACD2A7322780D7A8E5A46110E71FB:FG=1; USERID=f5a7193b428710f975e52280af974cbdf14a; bdime=1; BAIDU_WISE_UID=wapp_1297574075498_625; BD_UTK_DVT=1; BDSP=6b63f6246a610c33f07281da6cbccc05df14242916a9b827d2c7db37349b033b5bb5c9ea15ce36d3d539b6003af33a87e950352ac65c10385343fbf2b2119313b07eca8065380cd7912397dda144ad345982b2b7d0a20cf431adcbef76094b36a8afe07d; BDSTAT=d11373f05ab307e2557617b68d1d366e05a28bf3b436afc36d310a55b019dca0; Hm_lvt_4d16ad3b9adade3b562e5f64c3a01c5d=1297842283125; _time_stamp_=2; BDLFONT=0; pop_lover_76f0b6bccbb5ced2cff1c9f1beadb2a19d0a=yes; badgePilot_th_76f0b6bccbb5ced2cff1c9f1beadb2a19d0a=yes; GUIDE_76f0b6bccbb5ced2cff1c9f1beadb2a19d0a=yes; NO_GUIDE_76f0b6bccbb5ced2cff1c9f1beadb2a19d0a=yes"); //加标头rn //其他标头client.Headers.Add(......................");rn client.UploadString("http://hi.baidu.com/msg/msg_dataSendmsgTalk", "top.spNoticeTpl.message.msg_subResult&bdstoken=43be208cdb81428dee062ea3710a78a8&strUname=asd&strContent=asd&spVcode=" + aaa + "&Code=" + textBox1.Text); //POSTrn rn rn private void button2_Click(object sender, EventArgs e)rn rn Post("http://hi.baidu.com/msg/msg_dataSendmsgTalk", "top.spNoticeTpl.message.msg_subResult&bdstoken=43be208cdb81428dee062ea3710a78a8&strUname=asd&strContent=asd&spVcode=" + aaa + "&Code=" + textBox1.Text);rn rn rn
C#程序提示:并非有的代码路径返回值
protected int InsertNews(int value_id)rn rn string strCon = ConfigurationManager.ConnectionStrings["volenteerDBN"].ConnectionString.ToString();rn string strSql = "select * from News where NewsID='" + value_id + "'";rn SqlConnection con = new SqlConnection(strCon);rn con.Open();rn SqlCommand cmd = con.CreateCommand();rn cmd.CommandText = strSql;rn SqlDataAdapter sda = new SqlDataAdapter(cmd);rn DataSet ds = new DataSet();rn sda.Fill(ds, "information");rn DataList1.DataSource = ds;rn DataList1.DataBind();rn rn rn系统调试后说InsertNews(int)中<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn请问是怎么回事?
asp.net(C#)并非有的代码路径返回值
public bool IsExist(string artNo1)n n string artNo;n List list_artNo = new List();nn foreach (GridViewRow rows in GridView1.Rows)n n artNo = rows.Cells[0].Text;n list_artNo.Add(artNo);n n foreach (string item in list_artNo)n n if (item==artNo1.ToString())n n return true;n n if (item != artNo1.ToString())n n return false;n n n
并非有的代码路径返回值怎么解决
[code=C#]rn public DataView mybind()rn rn string s = System.Configuration.ConfigurationManager.AppSettings["strconn"];rn using (SqlConnection conn = new SqlConnection(s))rn rn string sel = "select * from art";rn conn.Open();rn SqlDataAdapter dr = new SqlDataAdapter(sel, conn);rn DataSet ds = new DataSet();rn dr.Fill(ds);rn grid.DataSource = ds;rn grid.DataBind();rn rn rn return;rn rn[/code]rn我把return 去掉提示rn“_Default.mybind()”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rnrn加上returnrn提示有错需要一个类型可转换为“System.Data.DataView”的对象
并非有的代码路径返回值??雅
public class brn rn public char connection(char[] str1,char[] str2)rn rn rn int i;rn for( i=0;i
求解(并非有的代码路径返回值)?????
[code=C#] private string timejia(string name, DataTable tt)rn rn TimeSpan tms = new TimeSpan();rn for (int i = 1; i < tt.Rows.Count;i++)rn rn if (tt.Rows[i][0].ToString() == name)rn rn DateTime time = Convert.ToDateTime(tt.Rows[i][12]);rn TimeSpan tmsall = new TimeSpan(time.Hour, time.Minute, time.Second);rn tms += tmsall;rn rn int timeH = tms.Days * 24 + tms.Hours;rn double timeM = Convert.ToDouble(tms.Minutes / 60.0);rn string all = "" + timeH + "" + "." + "" + timeM + "" + "小时";rn return all;rn rn [/code]rnrn错误提示:错误 3 “insert.timejia(string, System.Data.DataTable)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em> E:\net\EXCEL\App_Code\insert.cs 62 20 E:\net\EXCEL\rnrnif 里面知识一直加!!rn到下面才返回一个 值。。。rnrn然后在别的地方接值。 可是不知道是怎么回事?????rn 在线等。。赶进度呢!!
新手问题:并非有的代码路径返回值
public static int max(int x, int y)rn rn if (x > y)rn return x; rn else if (x < y)rn return y; rn else if (x == y)rn return 0; rn rn“ConsoleApplication1.MTool.max(int, int)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em> rn我又哪里错了
并非所有的代码路径返回值" 错在那里了?">"并非有的代码路径返回值" 错在那里了?
rn[color=#FF0000]为什么总是报错误----- "<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>"[/color]rnrn public int GetNonResult(string sql) //返回ExecuteNonQuery()rn rnrn tryrn //从web.config中取得数据库连接字符串rn string SqlConnectionStr = System.Configuration.ConfigurationSettings.AppSettings ["SqlConnectionStr"];rn //创建数据库连接对象rn SqlConnection Sqlconn = new SqlConnection(SqlConnectionStr); rn Sqlconn.Open();rnrn //创建Command对像rn SqlCommand Sqlcomm = new SqlCommand(sql, Sqlconn);rn //执行命命令rn Sqlconn.Open();rnrn int i = Sqlcomm.ExecuteNonQuery();rn if (i > 0)rn rn return i;rn rn elsern rn return 0;rn rn Sqlconn.Close();rn rn catch (SqlException e)rn rn System.Web.HttpContext.Current.Response.Write("错误的原因是:" + e.Message);rn rn rn rn rn rn
并非有的代码路径返回值 vb.net
我这个过程是这样,之后用一个按键下执行。rnFunction updateteacher() '将数据更新到数据库。rn MyConnection.Open()rn Tryrn MyCommand = New OleDbCommand("UPDATE teacher SET teachername ='" & Txtname1.Text & "',[password]='" & Txtpassword1.Text & "',coursesID='" & Txtcoursescode1.Text & "',grade='" & Combograde1.Text & "',class='" & Comboclass1.Text & "' WHERE teacherid = '" & txtuserid1.Text & "'", MyConnection)rn MyCommand.ExecuteNonQuery()rn Catch c As Exceptionrn MsgBox(c.ToString)rn End Tryrn MyConnection.Close()rn MyCommand.Dispose()rn End Functionrnrn我不明白这个是怎么回来,执行时提示:<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em> 。
并非所有的代码路径返回值"">怎么错误了 "并非有的代码路径返回值"
请大家帮我看一下函数怎么写错了,应该怎么修改呢? rn  public int Find() //错误<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn rn if(FrmQuitFind.s!=null)rn rn custds = findFacade.GetFindData(sql);rn tryrn rn custds = findFacade.GetFindData(sql);rn if(0 == custds.Tables[0].Rows.Count)rn rn return 0;rn rn rn rn elsern rn rn return 1;rn rn rn catch(Exception ex)rn rn QuickMessage.MsgInfo(ex.Message);rn rn rn rn============================================================rn if(s==1)rn rn this.DialogResult = DialogResult.OK;rn rn elsern rn this.DialogResult = DialogResult.None;rn rn rn rn
并非有的代码路径返回值”错误,
public static bool WriteFile(string strText,string strContent,string strAuthor) rnrn string yy=DateTime.Now.ToString("yyyy");rn string dd=DateTime.Now.ToString("dd");rn string mm=DateTime.Now.ToString("MM");rn string addtime=DateTime.Now.ToString();rnstring path = HttpContext.Current.Server.MapPath("/news/"+yy.ToString()+"/"+mm.ToString()+"/"+dd.ToString()+"/");rn Encoding code = Encoding.GetEncoding("gb2312");rn // 读取模板文件rn string temp = HttpContext.Current.Server.MapPath("/news/template/template.html");rn StreamReader sr=null;rn StreamWriter sw=null;rn string str=""; rn tryrn rn sr = new StreamReader(temp, code);rn str = sr.ReadToEnd(); // 读取文件rn rn catch(Exception exp)rn rn HttpContext.Current.Response.Write(exp.Message);rn HttpContext.Current.Response.End();rn sr.Close();rn rn rn string htmlfilename=DateTime.Now.ToString("yyyyMMddHHmmss")+".html";rn // 替换内容rn // 这时,模板文件已经读入到名称为str的变量中了rn str = str.Replace("$Title$",strText);rn str = str.Replace("$Content$",strContent);rn str = str.Replace("$Author$",strAuthor);rn str = str.Replace("$AddTime$",addtime);rnrn // 写文件rn if(!System.IO.Directory.Exists(path))rn rn System.IO.Directory.CreateDirectory(path);rn rn elsern rn tryrn rn sw = new StreamWriter(path + htmlfilename , false, code);rn sw.Write(str);rn sw.Flush();rn rn catch(Exception ex)rn rn HttpContext.Current.Response.Write(ex.Message);rn HttpContext.Current.Response.End();rn rn finallyrn rn sw.Close();rn rn return true;rn rn rnrn生成时出现以下错误rnD:\Hover\Conn.cs(141): “Hover.Conn.WriteFile(string, string,string)” : <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn是一个bool型生成html的函数,只是修改了按时间来生成文件夹目录,做了判断,以后就有这个错误了,这是怎么回事,错误是出在哪里呢
并非有的代码路径返回值是是什么错误?
“qbase.DataQuery.DataGridPage.gfun_CreateData()” : <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>?rnICollection gfun_CreateData()rnrn ……rn DataView lObj_DataView = new DataView(lObj_DataTable);rn return lObj_DataView;rnrn难道返回一个DataView数据集不对吗?rn
模糊查询的并非有的代码路径返回值..江湖救急
小弟在写一个商品查询,用的是AspNetPager分页控件。但是查询不到结果,提示是“<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>”rnWeb层:rn keyword是从首页的一个textbox 里面取出的:rnstring str = txtSearch.Text.Trim();rnResponse.Redirect("Search.aspx?keyword=" + str);rn然后查询页面:rn protected void getSearchList()rn rn str = Request.QueryString["keyword"];rn DataList1.DataSource = goodsInfoManage.getKeyword(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, str);rn DataList1.DataBind();rnrn rnDAL层:rnpublic List getKeyword(int pageIndex, int pageSize, string keyword)rn rn SqlParameter[] sqlParameters = rn new SqlParameter("@pageIndex",SqlDbType.Int),rn new SqlParameter("@pageSize",SqlDbType.Int),rn new SqlParameter("@Keyword",SqlDbType.VarChar)rn ;rn sqlParameters[0].Value = pageIndex;rn sqlParameters[1].Value = pageSize;rn sqlParameters[2].Value = keyword;rn List list = new List();rn SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.StoredProcedure, "User_Search", sqlParameters);rn while (reader.Read())rn rn GoodsInfo gi = new GoodsInfo();rn gi.GoodsID = int.Parse(reader["GoodsID"].ToString());rn gi.GoodsName = reader["GoodsName"].ToString();rn gi.MarketPrice = decimal.Parse(reader["MarketPrice"].ToString());rn gi.MemberPrice = decimal.Parse(reader["MemberPrice"].ToString());rn gi.GoodsPic_s = reader["GoodsPic_s"].ToString();rn gi.GoodsSDesc = reader["GoodsSDesc"].ToString();rn gi.Keyword = reader["Keyword"].ToString();rn list.Add(gi);rn rn reader.Dispose();rn return list;rn rn存储过程:rnCREATE procedure User_Search rn(@pagesize int,rn@pageindex int,rn@Keyword varchar(60))rnasrnset nocount onrnbeginrndeclare @indextable table(id int identity(1,1),nid int)rndeclare @PageLowerBound intrndeclare @PageUpperBound intrnset @PageLowerBound=(@pageindex-1)*@pagesizernset @PageUpperBound=@PageLowerBound+@pagesizernset rowcount @PageUpperBoundrninsert into @indextable(nid) select GoodsID from tb_GoodsInfo where GoodsName like '%@keyword%' or Keyword like '%@keyword%' order by GoodsID descrnselect O.GoodsID,O.GoodsName,O.MarketPrice,O.MemberPrice,O.GoodsPic_s,O.GoodsSDesc,O.Keyword from tb_GoodsInfo O,@indextable t where O.GoodsID=t.nidrnand t.id between @PageLowerBound+1 and @PageUpperBound and O.GoodsName like '%@keyword%' or O.Keyword like '%@keyword%' order by t.idrnendrnset nocount offrnGOrnrn存储过程什么的应该没问题,估计是那个keyword造成的,但是我有不知道怎么改,请各位高手帮忙指点下。
并非所有的代码路径返回值">"HLLW.ClassBase.blnConnectAccess(string)”: 并非有的代码路径返回值
请问这个错误怎么解决啊?rn我是新建的cs文件中要自定义一个方法,如下:rnbool blnConnectAccess(string strAccountPath)rn rn if (strAccountPath != "")rn rn if (System.IO.File.Exists(strAccountPath))rn rnrn rn elsern rn rn rn rn rnrn结果就是那个提示,不知为什么?怎么解决啊?我以前一直用VB 6.0的,现在改用C# 2005,好多不会啊!
错误 1 “Dal.boBusiness.loadKey()”: 并非有的代码路径返回值
文件一rn[code=C#]rnusing System;rnusing System.Collections.Generic;rnusing System.Text;rnrnnamespace Dalrnrn #region 连接数据库类rn /// rn /// 连接数据库参数rn /// rn class clsDBConnkeyrn rn //数据库<em>路径</em>rn public string DatabaseURL = "";rn //登陆密码 Login PassWordrn public string PassWord = "";rn //数据库服务器名称 Database Server Namern public string ServerName = "";rn //登陆用户名 Login UserNamern public string UserName = "";rn //数据库连接提供程序类型rn public EnumDBType DatabaseType;rn rn /// rn /// 数据库类型rn /// rn /// sqlserver数据库 rn public enum EnumDBTypern rn None = -1,rn sql = 0, //sqlserver数据库rn Oledb = 3 //access 数据库rn rn /// rn /// 数据库访问方式rn /// rn public enum executeMethodrn rn execute_NoneQuery = 0,rn execute_Reader = 1,rn execute_DataSet = 2,rn execute_Scalar = 3,rn execute_XmlReader = 4,rn execute_LineKey = 5rn rn #endregionrnrn[/code]rn文件二rn[code=C#]rnusing System;rnusing System.Collections.Generic;rnusing System.Text;rnrnnamespace Dalrnrn class boBusinessrn rn [color=#FF0000]public Dal.clsDBConnkey loadKey()[/color] 这里提示出错rn rn Dal.clsDBConnkey Connkey = new Dal.clsDBConnkey();rn Connkey.UserName = System.Configuration.ConfigurationManager.AppSettings["UID"];rn Connkey.PassWord = System.Configuration.ConfigurationManager.AppSettings["PWD"];rn Connkey.ServerName = System.Configuration.ConfigurationManager.AppSettings["Server"];rn Connkey.DatabaseURL = System.Configuration.ConfigurationManager.AppSettings["URL"];rn rn rnrnrn[/code]
C#运行提示:并非有的代码路径返回值
public string SearchWord(string english)rn rn WordNode p = Head;rn Current = p;rn for (int i = 0; i ; rn rn rn rn rn rnrn
错误 是 GetName() 并非有的代码路径返回值
public string GetName()rn rn string name = Convert.ToString(Request["name"]);rn string sql = "select * from Userinformation where UserName='" + name + "'";rn DataSet ds = kunmethod.GetDs(sql);rn if (ds.Tables[0].Rows.Count > 0)rn rn string dd = Convert.ToString(ds.Tables[0].Rows[0]["Password"]);rn string ee = Convert.ToString(ds.Tables[0].Rows[0]["Email"]);rn string ff = dd+","+ee;rn return ff;rn //1 字符串,2xml,3 json 4 jquery对象rn rn rn rn rn rn
vs2010提示“并非有的代码路径返回值
写了一个求质数的子函数,但是系统一直提示:“test.zihanshu(int)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>,怎么回事啊?rn protected Boolean zihanshu(int _betest)rn rn Boolean _result =true;rn for (int i = _betest / 2; i >=2; i--)rn rn if (_betest % i == 0)rn rn _result = false;rn break;rn rn return _result;rnrn rn rn
c#中“并非有的代码路径返回值
public string sqlexe(string sql)rn rn cmd = new SqlCommand(sql,con);rn con.Open();rn string bbn = cmd.ExecuteScalar().ToString();rn con.Close();rn return bbn; rn rnrn public void sqlexe2(string sql)rn rn cmd = new SqlCommand(sql, con);rn con.Open();rn string bbn = cmd.ExecuteNonQuery().ToString();rn con.Close();rn rnrn public int loginlog(string a, string b,string c)rn rn bool IsOverMaxLoginCount = true;rn int custid=0;rn //取CustomerIDrn string sql = "SELECT CustomerID FROM Customer where (LoginName = " + a + ") AND (PassWord = " + b + ")";rn string bdf = sqlexe(sql);rn if (bdf != null)rn rn custid = Convert.ToInt32(bdf);rn rn else rn rn return 0;//0 用户名或密码不存在 rn rn //用户过期判断rn string sql1 = "SELECT COUNT(*) FROM Customer where CustomerID= "+custid +" and (ExpiryTime>getdate() or ExpiryTime is null)";rn string jkh= sqlexe(sql1); rn if (jkh == null)rn rn return 0;//0 用户名或密码不存在rn rn elsern rn string sql2 = "SELECT LoginLog.* FROM LoginLog where CustomerId="+custid ;rn SqlDataAdapter custlog = new SqlDataAdapter(sql2, con);rn DataSet ds = new DataSet();rn custlog.Fill(ds, "custlog");rn DataTable tblcust;rn tblcust = ds.Tables["custlog"];rnrn if(tblcust.Rows.Count< 2)rn rn bool boltemp = false;//表示已经有此条数据rn foreach( DataRow dr in tblcust.Rows )rn rn if (dr["Mac"].ToString().ToUpper().Trim() == c.ToString().ToUpper().Trim())rn rn boltemp = true;rn return 1;//用户成功登陆rn rn rn rn if (boltemp == false)rn rn //llAdp.Insert(CustomerId, strmac, true);//插入MAC地址rn string sql3 = "INSERT INTO LoginLog (CustomerId ,Mac) VALUES ("+custid+","+c+")";rn sqlexe2(sql3);rn return 1;//用户登录成功,并写入MACrn rnrnrn rnrn else if (tblcust.Rows.Count == 2)rn rn bool boltemp = false;//表示已经有此条数据rn foreach (DataRow dr in tblcust.Rows)rn rn if (dr["Mac"].ToString().ToUpper().Trim() == c.ToString().ToUpper().Trim())rn rn boltemp = true;rn return 1;//用户成功登陆 rn rn rnrn if (boltemp)rn IsOverMaxLoginCount = false;rn elsern IsOverMaxLoginCount = true;rn rn elsern rn IsOverMaxLoginCount = true;rnrn rn if (IsOverMaxLoginCount)rn rn return 2;//您已经在2台机器上使用过该用户名登陆。登陆失败!rn rn rnrn
如何解决“并非有的代码路径返回值”?
提示我不是“<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>”?该怎么解决啊?rnrnDataTable dt = dbo.RunSqlDataTable("select * from PageUrlSet where id = '" + System.Web.HttpContext.Current.Request.QueryString["ID"] + "'");rn string[] strTemp = dt.Rows[0][10].ToString().Split(new char[] ',' ); //拆分字符串rn for (int i = 0; i < strTemp.Length; i++)rn rn DataTable dt1 = dbo.RunSqlDataTable("select * from userlist where id = '" + System.Web.HttpContext.Current.Session["ID"].ToString() + "'");rn string UserUnit = dt.Rows[0][5].ToString();rnrn if (strTemp[i] == UserUnit)rn rn return null;rn rn rn elsern rn string URL = " ";rn return URL ;rn //System.Web.HttpContext.Current.Response.Write(" ");rnrn rn
C#并非有的代码路径返回值 急,求助!!
服务端的<em>代码</em>rn public void Start()rn rn TServerSocket serverTransport = new TServerSocket(9091, 0, false);rn RPCService.Processor processor = new RPCService.Processor(new BusinessImpl());rn TServer server = new TSimpleServer(processor, serverTransport);rn ShowMsg("Starting server on port 9091 ...");rn server.Serve();rnrnrn rn public class BusinessImpl : RPCService.Ifacern rn rn rn Form1 frm = System.Windows.Forms.Application.OpenForms[0] as Form1;rn rn public void ShowMsg(string str)rn rn rn frm.txtMsg.AppendText(str + "\r\n");rn rn rn public byte[] SendRPCMessage(byte[] message)rn rnrn byte[] retData;rnrn retData = handleJushaServerCmd(message);rn rn return retData;rn rn rnrn rn public byte[] handleJushaServerCmd(byte[] message)rn rn ShowMsg("message[0] MessageTo = " + message[0]);rn ShowMsg("message[1] MessageName = " + message[1]);rn ShowMsg("message[2] MessageFormat = " + message[2]);rn int msgLen = message[3] + message[4] * 256;rn ShowMsg("message[3-4] MessageBodyLen = " + msgLen);rnrnrn ShowMsg("message body :");rn rn byte[] bodyret = new byte[msgLen];rn for (int k = 0; k < msgLen; k++)rn rn if (message[5 + k] != 0x0)rn rn bodyret[k] = message[5 + k];rn rn rn string bodyretStr = System.Text.Encoding.UTF8.GetString(bodyret);rnrn ShowMsg(bodyretStr);rn //生成<em>返回值</em>rnrnrn string msgbody = "\"light value\":34";rn int msgbodyLen = msgbody.Length;rn byte[] retData = new byte[5 + msgbodyLen];rn retData[0] = 6;rn retData[1] = 0;rn retData[2] = 1;rn //返回消息长度rn if (msgbodyLen < 256)rn rn retData[3] = (byte)msgbodyLen;rn retData[4] = 0;rn rn byte[] body = System.Text.Encoding.UTF8.GetBytes(msgbody);rn for (int k = 0; k < body.Length; k++)rn rn retData[5 + k] = body[k];rn rn return retData;rn rnrnrnrnrn这是服务端的<em>代码</em> 启动后 当客户端可以连上 ,但过一段时间服务端的程序就会无响应,但此时客户端仍然可以连接上服务器。也就是服务端仍在提供服务 ,但是程序界面却无响应了,求解决办法!!rnrnrn[color=#FF0000]现在知道是 “<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>” 求解决办法[/color]
并非有的代码路径返回值。。。。字符串截取
private string shuju(string string1)rn rn if (string1.Length>14)rn rn string1=string1.Substring(0,13)+"..";rn return string1;rn rn rn rnrnE:\wwwroot\1601200\XiYang\xiyang\production.aspx.cs(57): “_1601200.XiYang.xiyang.production.shuju(string)” : <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn请问这是怎么回事????rn该怎么做???
错误提示:并非有的代码路径返回值 急啊!!!
public bool checktime(DateTime oildate) rn rnrn string dstr = "";rn int lgh;rn DateTime dtime;rn string strtime = "SELECT OVERFLOW_DATE FROM FJOM_SEAOVERFLOW ORDER BY OVERFLOW_DATE DESC";rn Myconnection = new OleDbConnection(ConnectionString);rn myCommand = new OleDbDataAdapter(strtime, Myconnection);rn DataSet dsoil = new DataSet();rn myCommand.Fill(dsoil, "FJOM_SEAOVERFLOW");rn lgh = dsoil.Tables[0].Rows.Count;rn for (int j = 0; j < lgh; j++)rn rn dstr = dsoil.Tables["FJOM_SEAOVERFLOW"].Rows[j][0].ToString();rn dtime = DateTime.Parse(dstr);rnrn if (oildate == dtime)rn return true;rn elsern return false;rn rn rn
并非有的路径都有返回值。。
[code=C#]private int OtherScoreVal(string a , string q)rn rn string A = AnswerToDisplay(a);rn string Q = AnswerToDisplay(q);rn char[] ma = A.ToCharArray();rn char[] mq = Q.ToCharArray();rn int count = 0;rn char[] recount = ;rnrn if (a == "")rn rn return 0;rn rnrn if (ma.Length > mq.Length)rn rn return 0;rn rnrn for (int i = 0; i < ma.Length; i++)rn rn for (int j = 0; j < mq.Length; j++)rn rn if (ma[i] == mq[j])rn rn A = A.Remove(A.IndexOf(mq[j]), 1); rn break;rn rn rn rnrn for (int i = 0; i < mq.Length; i++)rn rn for (int j = 0; j < ma.Length; j++)rn rn if (mq[i] == ma[j])rn rn Q = Q.Remove(Q.IndexOf(ma[j]), 1); rn break;rn rn rn if (A.Length == 0 && Q.Length == 0)rn return 1;rnrn if ((A.Length != 0 && Q.Length != 0) || (A.Length == 0 && Q.Length != 0))rn return 0;rnrn if (A.Length != 0 && Q.Length == 0)rn rn int length = 0;rn length = ma.Length - A.Length;rn return length;rnrn if (length == mq.Length)rn rn return length;rn rn rn rn return 0;rnrnrnrnrn rn rn [/code]rnrn报错显示<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>。。但是我设置了的啊
并非有的代码都有返回值
大家好,小弟做一个asp。net项目,有一<em>代码</em>要搜索出菜单的一个节点:rn private MenuItem FindMenuItem(MenuItem startMenu, string menuValue)rn rn foreach (MenuItem mItem in startMenu.ChildItems)rn rn if (mItem.Value == menuValue)rn rn return mItem;rn rn else if (mItem.ChildItems.Count > 0)rn rn return FindMenuItem(mItem, menuValue);rn rn rn rn但是<em>代码</em>编译不了,说是<em>并非</em>所<em>有的</em><em>代码</em>都有<em>返回值</em>,请各位高手帮帮小弟看看该怎么解决。
并非有的代码都有返回值的问题
[code=C#] public int num(n)rnrnif(n30i)rnrnreturn i*n;//只有当n大于30i的时候才<em>返回值</em>rnbreak;rnrnrnrn[/code]rnrnrn<em>代码</em>如下,我想在n30i的时候才<em>返回值</em>,那么没有循环到n>30i的时候就继续执行循环,可是我这样做就会报错,说<em>并非</em>所<em>有的</em><em>代码</em>都有<em>返回值</em>的问题,该如何解决 啊?
并非所有的路径代码都有返回值"">help!"并非有的路径代码都有返回值"
提示:<em>并非</em>所<em>有的</em><em>路径</em><em>代码</em>都有<em>返回值</em>rn<em>代码</em>如下:rnpublic DataSet GetDataSet (string strSql)rn rn SqlConnection = Getstr();rn tryrn rn SqlConnection.Open();rn rn catchrn rn SqlConnection.Close();rn rn rnrn tryrn rn DataSet SqlDs = new DataSet();rn SqlDataAdapter SqlDa = new SqlDataAdapter(strSql,SqlConnection);rnrn SqlDa.Fill(SqlDs);rnrn return SqlDs;rn rn catchrn rn SqlConnection.Close();rn rn rn
并非所有的代码路径都有返回值;"!">求解决"并非有的代码路径都有返回值;"!
[code=csharp]rn /// rn /// 保存住院信息表rn /// rn /// rn private bool SaveClinicPatient(string pid, ref int vid, out string opid, out int ovid)rn rn if (!string.IsNullOrEmpty(pid))rn rn Model.T_ClinicPatient cpmodel = new Model.T_ClinicPatient();rnrn cpmodel.f_ClinicPatientID = pid;//住院号rn cpmodel.f_PatientID = pid;//病人IDrnrn if (vid != 0)rn rn cpmodel.f_VisitID = vid;rn rn elsern rn cpmodel.f_VisitID = 9999;//住院次数特殊标记标识为后来补录数据rn rnrn cpmodel.f_PatientID = pid;//病人IDrn cpmodel.f_ZhuYaoZhenDuanDesc = txtZhuYaoZhenDuanDesc.Value;//诊断rnrn int i = 0;rn while (i > 0)rn rn if (!cpbll.Exists(cpmodel.f_ClinicPatientID, cpmodel.f_VisitID))//判断是否存在这次住院信息rn rn if (cpbll.Add(cpmodel))rn rn opid = cpmodel.f_ClinicPatientID;rn ovid = cpmodel.f_VisitID;rn return true;//添加病人成功rn rn elsern rn opid = null;rn ovid = 0;rn ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "PICCJS.Win.Warn('添加病人失败!');", true);rn return false;//添加病人失败rn rn i++;rn rn elsern rn if (cpmodel.f_VisitID >= 9999)rn rn cpmodel.f_VisitID++;rnrn continue;rn rn elsern rn cpmodel = cpbll.GetModel(cpmodel.f_ClinicPatientID, cpmodel.f_VisitID);rn if (cpbll.Update(cpmodel))rn rn opid = cpmodel.f_ClinicPatientID;rn ovid = cpmodel.f_VisitID;rn return true;//修改信息成功rn rn elsern rn opid = null;rn ovid = 0;rn ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "PICCJS.Win.Warn('修改信息失败!');", true);rn return false;//修改信息失败rn rn i++;rn rn rn rn rn elsern rn opid = null;rn ovid = 0;rn ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "PICCJS.Win.Warn('住院号/病人ID为空!');", true);rn return false;rn rnrnrn rn[/code]
求助:并非有的代码路径都有返回值
我定义了一个调用数据库的函数,<em>返回值</em>是一个SqlDataReader,在try语句中返回,在catch语句中用信息框的形式输出错误信息。rn但编译后提示我<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都有<em>返回值</em>,请问catch语句中也要有return 吗?
菜鸟求教,并非有的代码路径都有返回值
[code=csharp] public string GetNextStatus() rn string StrSQL;rn string strTemp;rn SqlConnection conn = new SqlConnection(Getconn());rn conn.Open();rn SqlCommand cmd = new SqlCommand();rn cmd.Connection = conn;rn StrSQL = "SELECT NEXTSTATUS FROM TB_LWS WHER WHERE ";rn StrSQL = StrSQL + "NEXTSTATUS IN ('030','040','050') and LWSEvent = @LWSEvent";rn cmd.CommandText = StrSQL;rn cmd.Parameters.Add("@LWSEvent", SqlDbType.Char, 3).Value = LWSEvent;rn SqlDataReader dr = cmd.ExecuteReader();rn tryrn rn dr.Read();rn if (dr.HasRows == false)rn rn dr.Close();rn return "030".ToString();rn rn strTemp = dr["NEXTSTATUS"].ToString();rn if (strTemp.Equals("030".ToString()))rn rn dr.Close();rn return "040".ToString();rn rn if (strTemp.Equals((string)"040"))rn rn dr.Close();rn return "050".ToString();rn rn rn catch (Exception ex)rn rn Console.WriteLine(ex.Message);rn throw;rn rn finally rn //dr.Close();rn conn.Close();rn rn [/code]rn总是提示“<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都有<em>返回值</em>”rn看了半天了,没找出原因来。
并非所以代码路径返回值的问题。。
<em>代码</em>如下:rn[code=C#]rn public static DataTable InsertDataByTipMsg(string LinkID, string Mobile, string LongPhone, string content, int price)rn rn //位客户ID号+_+批次号+_+应用ID+_+计费点IDrn StringBuilder sb = new StringBuilder();rn DataTable dt = new DataTable();rn int smskey = 1;rn int ishidden = 1;rnrn tryrn rn sb.Append("insert into SunTengSideals(LinkID,Mobile,RequestDate,LongPhone,MountCode,GameCode,ChargeCode,Devicecode,SMSKey,ReceiveQuery,Price,ResponseStatus,IsHidden) values('");rn sb.Append(LinkID + "','"); //linkidrn sb.Append(Mobile + "',");rn sb.Append("getdate(),'");rn sb.Append(LongPhone + "','");rn string[] infos = content.Split('_');rn if (infos.Length >= 4)rn rnrn int len = infos[2].Length;rn for (int i = 1; i , true);rnrn rnrn rn[/code]rn编译时报错:<em>并非</em>所以<em>代码</em>都<em>返回值</em>。。rn大家帮忙看看
并非所有代码路径返回值
protected SqlConnection createLoginConn() rn rnSqlConnection con = new SqlConnection("server=;database=yhdl;uid=sa;pwd=123456;"); rn rnrnrn就是它 啊 "createLoginConn" 出错啊 提示是:<em>并非</em>所有<em>代码</em>的<em>路径</em>都<em>返回值</em>
并非所有代码路径返回值
using System;rnusing System.Collections.Generic;rnusing System.ComponentModel;rnusing System.Data;rnusing System.Drawing;rnusing System.Linq;rnusing System.Text;rnusing System.Windows.Forms;rnusing ESRI.ArcGIS.Carto;rnusing ESRI.ArcGIS.Controls;rnusing ESRI.ArcGIS.esriSystem;rnusing ESRI.ArcGIS.SystemUI;rnusing ESRI.ArcGIS.Geometry;rnusing ESRI.ArcGIS.Geodatabase;rnrnnamespace _3sdnMaprnrn public partial class AttributeTableFrm : Formrn rn public DataTable attributeTable; rn public AttributeTableFrm()rn rnrn InitializeComponent();rnrn rnrn private void AttributeTableFrm_Load(object sender, EventArgs e)rn rnrn rn private static DataTable CreateDataTableByLayer(ILayer pLayer, string tableName)rn rn //创建一个DataTable表 rn DataTable pDataTable = new DataTable(tableName);rn //取得ITable接口 rn ITable pTable = pLayer as ITable;rn IField pField = null;rn DataColumn pDataColumn;rn //根据每个字段的属性建立DataColumn对象 rn for (int i = 0; i < pTable.Fields.FieldCount; i++)rn rn pField = pTable.Fields.get_Field(i);rn rn pDataColumn = new DataColumn(pField.Name);rn if (pField.Name == pTable.OIDFieldName)rn rn pDataColumn.Unique = true;//字段值是否唯一 rn //字段值是否允许为空 rn pDataColumn.AllowDBNull = pField.IsNullable;rn //字段别名 rn pDataColumn.Caption = pField.AliasName;rn //字段数据类型 rn pDataColumn.DataType = System.Type.GetType(ParseFieldType(pField.Type));rn //字段默认值 rn pDataColumn.DefaultValue = pField.DefaultValue;rn //当字段为String类型是设置字段长度 rn if (pField.VarType == 8)rn rn pDataColumn.MaxLength = pField.Length;rn rn //字段添加到表中 rn pDataTable.Columns.Add(pDataColumn);rn pField = null;rn pDataColumn = null;rn rn return pDataTable;rn rn rnrn private static string ParseFieldType(esriFieldType esriFieldType)rn rn switch (fieldType)rn rn case esriFieldType.esriFieldTypeBlob:rn return "System.String";rn case esriFieldType.esriFieldTypeDate:rn return "System.DateTime";rn case esriFieldType.esriFieldTypeDouble:rn return "System.Double";rn case esriFieldType.esriFieldTypeGeometry:rn return "System.String";rn case esriFieldType.esriFieldTypeGlobalID:rn return "System.String";rn case esriFieldType.esriFieldTypeGUID:rn return "System.String";rn case esriFieldType.esriFieldTypeInteger:rn return "System.Int32";rn case esriFieldType.esriFieldTypeOID:rn return "System.String";rn case esriFieldType.esriFieldTypeRaster:rn return "System.String";rn case esriFieldType.esriFieldTypeSingle:rn return "System.Single";rn case esriFieldType.esriFieldTypeSmallInteger:rn return "System.Int32";rn case esriFieldType.esriFieldTypeString:rn return "System.String";rn default:rn return "System.String";rn ;rn rn rn rn public static DataTable CreateDataTable(ILayer pLayer, string tableName) rn rn //创建空DataTable rn DataTable pDataTable = CreateDataTableByLayer(pLayer, tableName);rn //取得图层类型rn string shapeType = getShapeType(pLayer);rn //创建DataTable的行对象rn DataRow pDataRow = null;rn //从ILayer查询到ITable rn ITable pTable = pLayer as ITable;rn ICursor pCursor = pTable.Search(null, false);rn //取得ITable中的行信息rn IRow pRow = pCursor.NextRow();rn int n = 0;rn while (pRow != null)rn rn //新建DataTable的行对象rn pDataRow = pDataTable.NewRow();rn for (int i = 0; i < pRow.Fields.FieldCount; i++)rn rn //如果字段类型为esriFieldTypeGeometry,则根据图层类型设置字段值rn if (pRow.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)rn rn pDataRow[i] = shapeType;rn rn //当图层类型为Anotation时,要素类中会有esriFieldTypeBlob类型的数据,rn //其存储的是标注内容,如此情况需将对应的字段值设置为Element rn else if (pRow.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeBlob)rn rn pDataRow[i] = "Element";rn rn elsern rn pDataRow[i] = pRow.get_Value(i);rn rn rn pDataTable.Rows.Add(pDataRow);rn pDataRow = null;rn n++;rn //为保证效率,一次只装载最多条记录rn if (n == 2000)rn rn pRow = null;rn rn elsern rn pRow = pCursor.NextRow();rn rn rn return pDataTable;rn rnrn public static string getShapeType(ILayer pLayer)rn rn IFeatureLayer pFeatLyr = (IFeatureLayer)pLayer;rn switch (pFeatLyr.FeatureClass.ShapeType)rn rn case esriGeometryType.esriGeometryPoint:rn return "Point";rn case esriGeometryType.esriGeometryPolyline:rn return "Polyline";rn case esriGeometryType.esriGeometryPolygon:rn return "Polygon";rn default:rn return "";rn rn rnrnrn public void CreateAttributeTable(ILayer player) rnrn string tableName; rn tableName = getValidFeatureClassName(player.Name); rn attributeTable = CreateDataTable(player, tableName);rn this.dataGridView1.DataSource = attributeTable;rn this.Text = "属性表[" + tableName + "] " + "记录数:" + attributeTable.Rows.Count.ToString();rn rnrn rn public static string getValidFeatureClassName(string FCname)rn rn int dot = FCname.IndexOf(".");rn if (dot != -1)rn rn return FCname.Replace(".", "_");rn rn return FCname;rn rnrnrn public static esriFieldType fieldType get; set; rn rn
咋个报:并非有的代码路径都返回
[code=C#]rnprotected int ReadSFMS(string xxdm)rn rn SqlParameter[] para = rn new SqlParameter("@xx_dm",SqlDbType.Char,5)rn ;rn para[0].Value = xxdm;rn if (xxdm.Trim() != "")rn rn tryrn rn MyAcc.RunProcForDataReader("Pre_School_Search", para, out MyRead);rn if (MyRead.Read())rn rn if (MyRead["qr_end_t"].ToString().Trim() != "")rn rn return 2;//不需要面试rn rn elsern rn return 1;//需要面试rn rn rn elsern rn return 1;rn rn rn catch (Exception err)rn rn MyAcc.Show(err.Message);rn rn finallyrn rn MyRead.Close();rn rn rn elsern rn return 1;rn rn rn[/code]rn这段<em>代码</em>运行后怎么报:rn错误 1 “_Default.ReadSFMS(string)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>
并非所有的代码路径返回值"">方法返回值的问题,提示"并非有的代码路径返回值"
public string GetPANO(string EmpNO)rn rn string ResultStr;rn string SelectStr ="select pa_no from iepa00h where substring(pa_card,2,5)='" + EmpNO +"'";rnrn tryrn rn SqlConnection m_cn=new SqlConnection(Connection_String2);rnrn SqlCommand cmd=new SqlCommand(SelectStr,m_cn);rn m_cn.Open ();rn SqlDataReader mydr;rn rn mydr=cmd.ExecuteReader();rn rn if (mydr.Read())rn rn ResultStr = (mydr.GetSqlString(0).ToString() );rn rn rn elsern rn ResultStr="";rn //return ResultStr;rn rn mydr.Close() ;rnrn m_cn.Close(); rn return ResultStr;rn rn rn catch (Exception ex)rn rn MessageBox.Show(ex.Message ,ex.Source); rn rn rn
不是所有的控件路径返回值???
#include rn#include rn#include rn#include rnrnusing namespace std;rnvoid printSudoku(int[][9]);rnbool isLegal(int,int,int[][9],int);rnbool solve(int,int,int[][9]);rnvoid stringAnalyze(string[],int[][9]);rnrnint main()rn string orders[30] = "018","034","052","076","113",rn "124","169","171","209","216",rn "278","284","332","341","356",rn "533","545","557","608","614",rn "677","685","712","726","761",rn "773","819","837","851","874";rn int sudoku[9][9] = 0,0,0,0,0,0,0,0,0,rn 0,0,0,0,0,0,0,0,0,rn 0,0,0,0,0,0,0,0,0,rn 0,0,0,0,0,0,0,0,0,rn 0,0,0,0,0,0,0,0,0,rn 0,0,0,0,0,0,0,0,0,rn 0,0,0,0,0,0,0,0,0,rn 0,0,0,0,0,0,0,0,0,rn 0,0,0,0,0,0,0,0,0rn ;rn stringAnalyze(orders,sudoku);rn printSudoku(sudoku);rn// for(int i = 0;i < 9;i++)rn// for(int j = 0;j < 9;j++)rn// solve(j,i,sudoku);rn// rn// rn solve(0,0,sudoku);rn cout << "\n";rn printSudoku(sudoku);rn return 0;rnrnrnvoid stringAnalyze(string orders[],int sudoku[][9])rn for(int count = 0;count < 30;count++)rn const char* point = orders[count].c_str();rn int tmp = atoi(point);rn int i = tmp / 100;rn int j = tmp / 10 - i * 10;rn int value = tmp % 10;rn sudoku[i][j] = value;rn rnrnrnvoid printSudoku(int sudoku[][9])rn for(int i = 0;i < 9;i++)rn for(int j = 0;j < 9;j++)rn cout << sudoku[i][j] << " ";rn rn cout << "\n";rn rnrnrnbool isLegal(int i,int j,int sudoku[][9],int value)rn for(int count = 0;count < 9;count++)rn if(count != i && sudoku[count][j] == value)rn return false;rn rn rn for(int count = 0;count < 9;count++)rn if(count != j && sudoku[i][count] == value)rn return false;rn rn rn int m = i / 3;rn int n = j / 3;rn for(int i = m * 3;i < 3 + m * 3;i++)rn for(int j = n * 3;j < 3 + n * 3;j++)rn if(sudoku[i][j] == value)rn return false;rn rn rn rn return true;rnrnrnbool solve(int i,int j,int sudoku[][9])rn// if(sudoku[i][j] != 0)rn// return;rn// elsern// for(int count = 1;count Sudoku.cpprn1>f:\projects\pd\pd\sudoku.cpp(111) : warning C4715: “solve”: 不是所<em>有的</em>控件<em>路径</em>都<em>返回值</em>rn1>正在链接...rn1>LINK : 没有找到 F:\Projects\PD\Debug\PD.exe 或上一个增量链接没有生成它;正在执行完全链接rn1>正在嵌入清单...rn1>生成日志保存在“file://f:\Projects\PD\PD\Debug\BuildLog.htm”rn1>PD - 0 个错误,1 个警告rnrn用的是VS2008,不清楚是什么问题。。。求高手解答下
高分求解 上传解压代码 编译时候提示 xRar 并非有的代码路径返回值
用rar上传解压提示 编译时候提示 xRar <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rnrnrn<em>代码</em> rnstring _RarPath = System.Web.HttpContext.Current.Server.MapPath("./Inc/Rar.exe");rnrn public static string xRar(string RarFile, string ExctTo)rn rn string agt = "x -idp -r -tk -y \""+ RarFile +"\" \""+ ExctTo + "\"";rn Process Proc = new Process();rn ProcessStartInfo ProcInfo = new ProcessStartInfo(_RarPath);rn ProcInfo.UseShellExecute = false;rn ProcInfo.RedirectStandardOutput= true;rn ProcInfo.CreateNoWindow = false;rn ProcInfo.Arguments = agt;rn Proc.StartInfo = ProcInfo;rn tryrn rn Proc.Start();rn rn StreamReader sr = Proc.StandardOutput;rn Proc.Close();rn string s = sr.ReadToEnd();rn sr.Close();rn return s;rn rn catch(Exception Ex)rn rn rn rn rn解压部分rn protected void Upload_Click(object sender, EventArgs e)rn rn if ((UploadedFile.PostedFile == null) || (UploadedFile.PostedFile.FileName.Length ; rn rn rnrnrnrn rn
大家帮忙看我写的代码...万分感谢:并非有的代码路径返回值
public DataSet GetDataSet(string strSQL)rn rn tryrn rn Open();rn myCMD = myCon.CreateCommand();rn myCMD.CommandText = strSQL;rn SqlDataAdapter adapter = new SqlDataAdapter();rn adapter.SelectCommand = myCMD;rn DataSet dataset = new DataSet();rn adapter.Fill(dataset);rn if (dataset.Tables[0].Rows.Count > 0)rn rn return dataset;rn rn elsern rn return null;rn rn rn catch(Exception ex)rn rn MessageBox.Show(ex.Message ,"错误信息");rn rn rnrn<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>---这个错误!
提示:“method”: 并非有的代码路径返回值,是什么意思呀,代码如下
public class hasQuotesrn rn public bool hasQuote(string inputString)rn rn for (int i=0;i
请问:这段简单的代码,为什么报错“并非有的代码路径返回值”?
一个类,public class Person:IComparable ,其中写了一个方法。rnrn int IComparable.CompareTo(object obj)rn rn Person p2 = (Person)obj;rnrn if (this.FirstName.CompareTo(p2.FirstName) > 0)rn return 1;rn if (this.FirstName.CompareTo(p2.FirstName) < 0)rn return -1;rn if (this.FirstName.CompareTo(p2.FirstName) == 0)rn return 0;rn rn生成时候,系统报错:“Person.System.IComparable.CompareTo(object)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>。rn为什么会这样呢?我觉得所有<em>路径</em>,都可以返回数值阿。rn非常谢谢大家啊。
错误: ————————并非有的代码路径返回值代码已在下面:
using System;rnusing System.Collections.Generic;rnusing System.Linq;rnusing System.Text;rnrnnamespace jichengrnrn class Furniturern rn string colour;rn float height;rn float length;rn public Furniture(string a, float b, float c)rn rn colour = a ;rn height = b ;rn length = c ;rn rn public string display1()rn rn Console.WriteLine("颜色:0", colour );rn rn public float display2()rn rn Console.WriteLine("高度:0 长度:1",height,length );rn rn rn class Bookshelf : Furniturern rn int shelf;rn public Bookshelf():base("红色",3.5f ,5.5f)rn rn shelf = 5;rn rn public int display3()rn rn Console.WriteLine("层数:0", shelf);rn rn rn class Chair : Furniturern rn int leg;rn public Chair():base("黄色",1.0f,0.5f)rn rn leg = 3;rn rn public int display4()rn rn Console.WriteLine("腿数:0", leg);rn rn rn class Programrn rn static void Main(string[] args)rn rn Bookshelf obj = new Bookshelf();rn obj.display1();rn obj.display2();rn obj.display3();rn Chair my = new Chair();rn my.display1();rn my.display2();rn my.display4();rn Console.ReadLine();rnrn rn rn rnrnrnrn
登入控件非所有的代码路径返回值
前台就一个登入控件rnWEB.CONFIG里增加了句rnrnrn[code=C#]rn protected void Login1_Authenticate1(object sender, AuthenticateEventArgs e)rn rn bool Authenticated = false;rn Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);rn e.Authenticated = Authenticated;rn if (Authenticated == true)rn rn Response.Redirect("Home.aspx");rn rnrn rn private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)rn rn bool boolReturnValue = false;rn SqlConnection Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLconnStr"].ConnectionString);rn String strSQL = "Select * From user";rn SqlCommand command = new SqlCommand(strSQL, Connection);rn SqlDataReader Dr;rn Connection.Open();rn Dr = command.ExecuteReader();rn while (Dr.Read())rn rn if ((UserName == Dr["name"].ToString()) & (Password == Dr["Paswd"].ToString()))rn rn boolReturnValue = true;rn rn Dr.Close();rn return boolReturnValue;rn rn rnrn[/code]rnrnrnrn运行时提示SiteLevelCustomAuthenticationMethod<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em> rn这是怎么回事?
错误:并非有的代码路径返回值,这是怎么回事呢?
我将上传图片的功能做成了一个布尔函数,成功则返回true,失败返回false,不知怎的,浏览器却返回了“<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>”的错误提示,我百思不得其解啊,只好请示帮助了。rn 下面是我做试验的函数。 rn private bool uppic()rn rn if (fupMark.HasFile) //fupMark是FileUpload控件。rn rn string fileContentType = fupMark.PostedFile.ContentType;rn if (fileContentType == "image/bmp" || fileContentType == "image/gif" || fileContentType == "image/pjpeg")rn rn string name = fupMark.PostedFile.FileName; // 客户端文件<em>路径</em>rnrn FileInfo file = new FileInfo(name);rn string fileName = file.Name; // 文件名称rn string webFilePath = Server.MapPath("/ImgUpload/" + fileName); // 服务器端文件<em>路径</em>rnrn if (!File.Exists(webFilePath))rn rn tryrn rn fupMark.SaveAs(webFilePath); // 使用 SaveAs 方法保存文件rn TextBox1.Text = "/ImgUpload/" + fileName;rn lblMessage.Text = "提示:文件“" + fileName + "”成功上传,文件大小为:" + fupMark.PostedFile.ContentLength + "B";rn return true;rn rn catch (Exception ex)rn rn lblMessage.Text = "提示:文件上传失败,失败原因:" + ex.Message;rn //return false;rn rn rn elsern rn lblMessage.Text = "提示:文件已经存在,请重命名后上传";rn return false;rn rn rn elsern rn lblMessage.Text = "提示:文件类型不符,请使用:bmp,gif,jpg格式";rn return false;rn rn rn
重写抽象类方法提示错误: 并非有的代码路径返回值
[code=C#]rn public abstract class abcrn rn internal virtual string getabc()rn rn rn rnrn internal class ABC : abcrn rn internal override string getabc()rn rn return "ccccccccc";rn rn rnrnrn class Programrn rn static void Main(string[] args)rn rn rn ABC Abc = new ABC();rn Console.WriteLine(Abc.getabc());rn Console.ReadKey();rn rn rn[/code]rnrn错误 1 “ConsoleApplication1.abc.getabc()”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>
问个错误:InputText(string,int)并非有的代码路径返回值
这个是怎么回事情,怎么解决?
编译器提示 : 并非有的代码路径返回值,可我没有看出来哪儿没有返回,帮忙?
public Symbol this[string name]rnrn getrn rn if(list != null)rn rn foreach(Symbol sy in list)rn rn if(sy.symName == name)rn rn return sy;rnrn rn elsern rn return null;rn rn rn rn elsern rn return null;rn rn rn
并非所有的代码路径返回值"">蛙蛙请教:出错提示"并非有的代码路径返回值"
蛙蛙请教:出错提示"<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>"rn我在类里写了个静态方法,用来上传东西,但是老是调试不成功,大家给看看,谢谢rnpublic static string upfile(System.Web.UI.Page p,System.Web.UI.HtmlControls.HtmlInputFile file1)rn rn if (file1.PostedFile != null) rn rn try rn rn string spath=p.Server.MapPath(p.Request.ApplicationPath)+ConfigurationSettings.AppSettings["uppath"]+oa.cls.globalstate.MakeRand(10)+System.IO.Path.GetFileName(file1.PostedFile.FileName);rn file1.PostedFile.SaveAs(spath);rn return spath;rnrn rn rn catch (Exception exc) rn rn throw exc;rn rnrn rn出错提示:rnE:\me\web.net\oa\cls\globalstate.cs(134): “oa.cls.globalstate.upfile(System.Web.UI.Page, System.Web.UI.HtmlControls.HtmlInputFile)” : <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn
并非所有的代码路径返回值" C#里报这样的错是什么意思?">"并非有的代码路径返回值" C#里报这样的错是什么意思?
TestMethods.ReTestMethods.MRer.MaxPow_MaxGain(System.Xml.XmlNode)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em> rnrn报这样的错是什么意思?
让我郁闷的错误: 并非有的代码路径返回值
<em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rnrn连我的编程漏洞都要管。。。rn
访问配置文件.Program.GetConfigValue(string, string)”: 并非有的代码路径返回值
我在做一个c#访问配置文件数据的小测试,但是在写的过程中断点调试时,总是提示:“访问配置文件.Program.GetConfigValue(string, string)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>”。文件在d盘当中,断点位置是在foreach的结束括号处。下面是<em>代码</em>,还请各位高手哥哥姐姐多多指教rnrnusing System;rnusing System.Collections.Generic;rnusing System.Linq;rnusing System.Text;rnrnnamespace 访问配置文件rnrn class Programrn rn static void Main(string[] args)rn rn rn static string GetConfigValue(string filename, string itemname)rn rn string[] lines = System.IO.File.ReadAllLines(@"d:\2.ini", Encoding.Default);rn rn foreach (string strs in lines)rn rn string[] str = strs.Split('=');rn rn rnrn rn rn
错误 1 “WebApplication1._Default.ispassed(string, string)”: 并非有的代码路径返回值
private bool ispassed(string usernane, string usepass)rn rn string usernane1 = this.TextBox1.Text.Trim();rn string usepass1 = this.TextBox2.Text.Trim();rn SqlConnection conn = new SqlConnection();rn conn.ConnectionString =@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\lwj\Desktop\Solution1\WebApplication1\App_Data\tb_admin.mdf;Integrated Security=True;User Instance=True";rn conn.Open();rn SqlCommand cmd = new SqlCommand();rn string sql = "select * from tb_main where tb_name='" + usernane1 + "'and tb_pwd='" + usepass1 + "' ";rn cmd.CommandText = sql;rn cmd.Connection = conn;rn SqlDataReader dr = cmd.ExecuteReader();rn if (dr.Read())rn rn if (usernane1 ==dr["tb_name"].ToString() && usepass1 ==dr["tb_pwd"].ToString()) rn rnrn return true;rn rn elsern rn return false;rn rn rn rnrn protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)rn rn if (ispassed(this.TextBox1.Text.Trim(), this.TextBox2.Text.Trim()))rn rn args.IsValid = true;rnrn rn elsern rn args.IsValid = false;rn rn
C# 并非有的代码路径返回值 请高手帮我看看
public string getipcraneno()rnrn rnrn string ip = "";rnrn string carno = "";rnrn string hostInfo = Dns.GetHostName();rnrn IPHostEntry localHostEntry = Dns.GetHostByName(hostInfo);rnrn for (int i = 0; i < localHostEntry.AddressList.Length; i++)rnrn rnrn ip = localHostEntry.AddressList[i].ToString(); //把本机所有网卡(如:双网卡)的IP地址列出来rnrn if (ip == "10.7.118.111")rnrn rnrn carno = "R01";rnrn rnrn rnrn rnrnrn错误“Crane001.Crane01.getipcraneno(string)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rn
并非有的代码路径返回值”这个问题怎么解决?
错误 1 “Tetris.BlockInfo.GetIdStr()”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em> F:\C# Language\Tetris\Tetris\BlockInfo.cs 40 23 Tetrisrnrn这段的<em>代码</em>如下:rnrn public string GetIdStr() //把似有成员变量_id转换为字符串并返回rn rn StringBuilder s = new StringBuilder(25);rn foreach (bool b in _id)rn rn s.Append(b ? "1" : "0");rn return s.ToString();rn rn
初学者碰到的问题:错误提示:并非有的代码路径返回值
在<em>代码</em>输入完要调试时出现这种情况,晕了,找不到错误在哪,我把这个<em>代码</em>贴出来,请大家帮忙看一下rnprivate long AddDirectory(DirectoryInfo dir,TreeNode tNode)rnrnFileSystemInfo[] fSIs=dir.GetFileSystemInfos();rnFileSystemInfo fSI;rnint i;rnlong directorySize=0;rnrnfor(i=0;i
并非有的代码路径返回值”大家来帮帮忙啦~~
[code=C#]rnpublic static CheckInfo GetInfo(string channelInfo, string cstcode,string province)rn rn XElement xmlPage = XElement.Parse(channelInfo);rn Hashtable channel = new Hashtable();rn List lChinese = new List();rn List lEnglish = new List();rn List lPhone = new List();rn string[] blockNumber = null;rn string[] blockChinese = null;rn string[] blockEnglish = null;rn string[] checkNumber = null;rn string[] checkChinese = null;rn string[] checkEnglish = null;rn string[] tcheckEnglish = null;rn string[] tcheckPhone = null;rn string[] tcheckChinese = null;rn CheckInfo check = null;rn rn tryrn rn string[] longphone = xmlPage.Descendants("sms").Select(s => s.Element("sms_number").Value).ToArray();rn string[] receivequery = xmlPage.Descendants("sms").Select(s => s.Element("sms_content").Value).ToArray();rn for (int i = 0; i < longphone.Length; i++)rn rn if (!channel.ContainsKey(longphone[i]))rn rn channel.Add(longphone[i], receivequery[i]);rn rn rn rn catch (Exception e)rn rnrn Console.WriteLine(e.Message.ToString());rn rn rnrn if (xmlPage.Element("sms_block").HasElements)rn rn tryrn rn var arryNumber = xmlPage.Element("sms_block").Element("block_number").Elements("keyword").Select(s => s.Value).ToArray();rn var arrayChinese = xmlPage.Element("sms_block").Element("block_chinese").Elements("keyword").Select(s => s.Value).ToArray();rn var arrayEnglish = xmlPage.Element("sms_block").Element("block_english").Elements("keyword").Select(s => s.Value).ToArray();rn blockNumber = arryNumber;rn blockChinese = arrayChinese;rn blockEnglish = arrayEnglish;rn rn catch (Exception e)rn rn blockNumber = new string[0];rn blockChinese = new string[0];rn blockEnglish =new string[0];rn Console.WriteLine(e.Message.ToString());rn rn StreamReader sr = null;rnrn if (cstcode.Equals("1"))rn rn sr = new StreamReader(@"d:\\text1.xml", Encoding.Default);rn string xml = sr.ReadToEnd();rnrn XElement xmlBlockPage = XElement.Parse(xml);rn var set = xmlBlockPage.Elements("finfo").Select(e => newrn rn longhone = e.Element("longphone").Value,rn receiveQuery = e.Element("receivequery").Value,rn fenglish = e.Elements("block_english").Select(s => s.Value).ToArray(),rn fchinese = e.Elements("block_chinese").Select(s => s.Value).ToArray(),rn fphone = e.Elements("block_number").Select(s => s.Value).ToArray()rn ).ToList();rn var tset = xmlBlockPage.Elements("yidong").Select(e => newrn rn tfenglish = e.Elements("block_english").Select(s => s.Value).ToArray(),rn tfchinese = e.Elements("block_chinese").Select(s => s.Value).ToArray(),rn tfphone = e.Elements("block_number").Select(s => s.Value).ToArray()rn ).ToList();rn foreach (var item in set)rn rn if (channel.ContainsKey(item.longhone))rn rnrn lEnglish.AddRange(item.fenglish);rn lChinese.AddRange(item.fchinese);rn lPhone.AddRange(item.fphone);rnrn rn rn foreach (var item1 in tset)rn rn tcheckEnglish = item1.tfenglish;rn tcheckChinese = item1.tfchinese;rn tcheckPhone = item1.tfphone;rn rnrnrn rn elsern rn sr = new StreamReader(@"d:\\text2.xml", Encoding.Default);rn string xml = sr.ReadToEnd();rnrn XElement xmlBlockPage = XElement.Parse(xml);rn var set = xmlBlockPage.Elements("finfo").Select(e => newrn rn longhone = e.Element("longphone").Value,rn receiveQuery = e.Element("receivequery").Value,rn fenglish = e.Elements("block_english").Select(s => s.Value).ToArray(),rn fchinese = e.Elements("block_chinese").Select(s => s.Value).ToArray(),rn fphone = e.Elements("block_number").Select(s => s.Value).ToArray()rn ).ToList();rn var tset = xmlBlockPage.Elements("liantong").Select(e => newrn rn tfenglish = e.Elements("block_english").Select(s => s.Value).ToArray(),rn tfchinese = e.Elements("block_chinese").Select(s => s.Value).ToArray(),rn tfphone = e.Elements("block_number").Select(s => s.Value).ToArray()rn ).ToList();rn foreach (var item in set)rn rn if (channel.ContainsKey(item.longhone))rn rn lEnglish.AddRange(item.fenglish);rn lChinese.AddRange(item.fchinese);rn lPhone.AddRange(item.fphone);rn rn rn foreach (var item in tset)rn rn tcheckEnglish = item.tfenglish;rn tcheckChinese = item.tfchinese;rn tcheckPhone = item.tfphone;rn rnrn rn checkNumber = lPhone.ToArray();rn checkEnglish = lEnglish.ToArray();rn checkChinese = lChinese.ToArray();rn sr.Close();rnrn tryrn rn if (tcheckEnglish.Count() > 0)rn rn Array.Resize(ref checkEnglish, checkEnglish.Length + tcheckEnglish.Length);rn Array.Copy(tcheckEnglish, 0, checkEnglish, checkEnglish.Length - tcheckEnglish.Length, tcheckEnglish.Length);rn rn if (tcheckChinese.Count() > 0)rn rn Array.Resize(ref checkChinese, checkChinese.Length + tcheckChinese.Length);rn Array.Copy(tcheckChinese, 0, checkChinese, checkChinese.Length - tcheckChinese.Length, tcheckChinese.Length);rn rn if (tcheckPhone.Count() > 0)rn rn Array.Resize(ref checkNumber, checkNumber.Length + tcheckPhone.Length);rn Array.Copy(tcheckPhone, 0, checkNumber, checkNumber.Length - tcheckPhone.Length, tcheckPhone.Length);rn rn rn catch (Exception e)rn rnrn Console.WriteLine(e.Message.ToString());rn rn string filename = "";rn if (filename == "1")rn rn filename = "YiDong";rn rn elsern rn filename = "LianTong";rn rn if (!File.Exists(@"d:\\" + filename + "NewBoxResult.txt"))rn rn FileStream fs = File.Create(@"d:\\" + filename + "NewBoxResult.txt");rn fs.Close();rn check = CheckData.Check(blockNumber, blockChinese, blockEnglish, checkNumber, checkChinese, checkEnglish, province, filename);rn rn elsern rnrn check = CheckData.Check(blockNumber, blockChinese, blockEnglish, checkNumber, checkChinese, checkEnglish, province, filename);rn rn rnrn return check;rn rnrnrn rn rn[/code]rn上面的<em>代码</em>报错。。“TestXML.CheckData.GetInfo(string, string, string)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em> rn这是怎么回事呢?
CS0161: “QuoteNEC2000IPS.GetResult(int, int, int)”: 并非有的代码路径返回值
请高手解决:rn说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源<em>代码</em>。 rnrn编译器错误信息: CS0161: “QuoteNEC2000IPS.GetResult(int, int, int)”: <em>并非</em>所<em>有的</em><em>代码</em><em>路径</em>都<em>返回值</em>rnrn源错误:rnrn rnrn行 305: /// rn行 306: /// 返回一个类,存放需要的8路外线卡、8路数字分机卡、8路模拟分机卡、机柜、底座、中央处理器卡、辅助处理器卡、沟通界面连接线、外部电源连接线、直流电源连接线、128port应用软件、128port扩充应用软件、256port应用软件、384port应用软件、512port应用软件、音频激发器卡、PBX配线电缆的数量rn行 307: public Result GetResult(int OutPortNum, int DigExtensionNum, int SimExtensionNum)rn行 308: rn行 309: Result result = new Result();rn rnrn源文件: e:\n\3CMarket\QuoteNEC2000IPS.aspx.cs 行: 307
c#中“并非有的代码路径返回值”错误的原因和解决方法
谢谢各位大哥、大姐!
FAT32系统详解10011下载
FAT32系统详解 详细地介绍了FAT32一些相关知识 相关下载链接:[url=//download.csdn.net/download/qq782645210/2069060?utm_source=bbsseo]//download.csdn.net/download/qq782645210/2069060?utm_source=bbsseo[/url]
luncene in action 003下载
luncene in action 003 相关下载链接:[url=//download.csdn.net/download/jennyzhu188/3011511?utm_source=bbsseo]//download.csdn.net/download/jennyzhu188/3011511?utm_source=bbsseo[/url]
操作系统课设:处理机调度下载
操作系统课程报告,关于处理机调度算法,里面有完整的程序代码 简单易懂 相关下载链接:[url=//download.csdn.net/download/meili12/4402408?utm_source=bbsseo]//download.csdn.net/download/meili12/4402408?utm_source=bbsseo[/url]
相关热词 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法 c# gmail 发邮件 c# 多层文件
我们是很有底线的