我该如何解析一个空字符串?int.Parse(Textbox1.text)给我一个错误:
输入字符串的格式不正确.
System.FormatException:输入字符串的格式不正确.
如果文本为空(Textbox1.text = ''),则会抛出此错误.我理解这个错误,但不知道如何纠正这个.
我是一台Windows 8机器.我安装了Visual Studio 2012,然后转到Microsoft SQL Server 2012.后来我被告知安装Visual Studio 2010.前两个安装工作得很好.得到了所有整洁的图标,一切都很好.MSVS2010 SP1已成功安装.
现在第三次安装Visual Studio 2010就是我被困住的地方.我从Microsoft许可的CD下载它.安装过程中没有错误,但它只安装Microsoft Visual Studio命令提示符,X64 Win64命令提示符和Microsoft Visual Studio 2010文档.没有其他的.所以基本上我不知道从哪里开始启动程序.
所以我去了C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7,C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7找到了devenv.exe.找不到任何一个位置.
然后去Run并输入devenv.exe,热火VS2010打开.所以我在Windows 8上进行了应用程序搜索.当我输入devenv.exe时,我唯一能找到的是具有VS2010图标的SQL Server数据工具.双击此按钮,VS 2010将打开.所以我的猜测是SQL Server 2012需要VS2010并安装它.
问题:
我不认为双击sql server数据工具是正确的方法.我希望VS2010能像任何其他应用程序一样出现在我的应用程序中.这可能是一个相当愚蠢的问题.我做了很多研究,并且对所有这些参数感到困惑.
我的aspx页面中有以下图像
<td>
<asp:Image ID="LargeImage" runat="server" Height="100" Width="100" />"
</td>
Run Code Online (Sandbox Code Playgroud)
在我的aspx.cs中,为此图像指定了一个图像
protected void uploadimage_Click(object sender, System.EventArgs e)
{
ImageUtils.uploadImage(Titletxt.Text, FileUpload.FileContent);
LargeImage.ImageUrl = "~/AvatarImageFetch.ashx?memberid=" + memberid.ToString();
}
Run Code Online (Sandbox Code Playgroud)
由于某种原因,图像不会显示.这是我的ashx
public void ProcessRequest(HttpContext context)
{
SqlConnection myConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["FMMImages"].ConnectionString);
myConnection.Open();
string sql = "select largeimage from images_temp where id=@memberid";
SqlCommand cmd = new SqlCommand(sql, myConnection);
int param;
int.TryParse(context.Request.QueryString["memberid"], out param);
cmd.Parameters.Add("@memberid", SqlDbType.Int).Value = param;
//cmd.Parameters.Add("@GuID", SqlDbType.UniqueIdentifier).Value = context.Request.QueryString["UID"].ToString();
cmd.CommandType = System.Data.CommandType.Text;
SqlDataReader dReader = cmd.ExecuteReader();
dReader.Read();
context.Response.BinaryWrite((byte[])dReader["largeimage"]);
dReader.Close();
myConnection.Close();
}
Run Code Online (Sandbox Code Playgroud)
另外,我在ashx处理程序中有一个断点.看起来处理程序没有触发.
我在Windows窗体应用程序C#中使用wpf.跟进问题. 将一组实线虚线笔添加到组合框中
错误:项目文件必须在参考列表中包含.NET Framework程序集"WindowsBase,PresentationCore,PresentationFramework".
请建议
太阳
我正在尝试更改一些custommessage编码器使用此博客
http://www.falconwebtech.com/post/2010/05/24/WCF-Interoperability-and-Extensibility-Part-Two.aspx
Run Code Online (Sandbox Code Playgroud)
这里作者使用了一种扩展方法
xmlMessage.Descendants(sec + "Security").First().Add(samlXml);
Run Code Online (Sandbox Code Playgroud)
我使用什么命名空间.首先这是我得到的错误
'System.Collections.Generic.IEnumerable'不包含'First'的定义,也没有扩展方法'First'接受类型为'System.Collections.Generic.IEnumerable'的第一个参数'(你是否缺少using指令)或汇编参考?)
我包含以下命名空间
using System;
using System.IO;
using System.Security.Cryptography;
using System.ServiceModel.Channels;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Xml.XPath;
using System.Security.Cryptography.Xml;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Web.Services3.Security;
using System.ServiceModel.Security;
using System.IdentityModel.Tokens;
Run Code Online (Sandbox Code Playgroud)
我可以完成我的研究,但我正在采取简单的方法
谢谢
我收到了这个错误.
Locating source for 'C:\Users\cem\Documents\Visual Studio 2008\Projects\CS.Web.Controls\WebCropImage\CropImage.cs'. Checksum: MD5 {20 55 30 34 b8 e3 ee df 89 75 e5 b5 36 b6 13 21}
Determining whether the checksum matches for the following locations:
1: C:\Users\sun\Desktop\trunk\CS.WebControls\WebCropImage\CropImage.cs Checksum: MD5 {5d 31 b6 21 f5 1 36 8b c0 25 dd b9 1e ff d7 89} Checksum doesn't match.
2: C:\Users\sun\Downloads\WebCropImage.UI\CropImage.cs Checksum: MD5 {5d 31 b6 21 f5 1 36 8b c0 25 dd b9 1e ff d7 89} Checksum doesn't match. …Run Code Online (Sandbox Code Playgroud) 我试图从命令提示符运行sqlite.所以我从这个网站上下载了sqlite-shell-win32-x86-3071100.zip http://www.sqlite.org/download.html
现在有一个set up.exe,v可以从中运行sqlite命令.当我说
C:\Users\..>'sqlite3' is not recognized as an internal or external com
''sqlite3'' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
任何提示.
谢谢孙
我对这个IIS有太多麻烦.首先它给我一个错误虚拟目录被拒绝.
我意识到文档选项卡中没有default.aspx ..(它有default.asp,default.htm,iistart,index.htm).检查liitle box是否启用默认文档
现在它说无法访问IIS元数据库说明:在执行当前Web请求期间发生了未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
异常详细信息:System.Web.Hosting.HostingEnvironmentException:无法访问IIS元数据库
这是第一次使用IIS ..所以我需要你的提示和修复
谢谢SC
我收到此错误集合已修改;枚举操作可能无法执行。
我有3个表格。这些是所有 3 个的表单关闭事件我做了一些研究并了解到其中一些被修改/显示导致此错误
表格1
private void btnExitl_Click(object sender, EventArgs e)
{
this.Close();
}
private void frmPlant_FormClosing(object sender, FormClosingEventArgs e)
{
if (DataDirty)
{
if (DialogResult.Yes == MessageBox.Show("Are you sure you want to exit", "Data Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
Application.Exit();
else
e.Cancel = true;
}
else
Application.Exit();
}
Run Code Online (Sandbox Code Playgroud)
表格2:
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void frmInputFiles_FormClosing(object sender, FormClosingEventArgs e)
{
int plantid = StaticClass.GlobalValue;
//Properties.Settings.Default.PlantId = plantid;
Program.fPlant = new frmPlant(plantid);
Program.fPlant.Show();
e.Cancel = false;
//this.Hide(); …Run Code Online (Sandbox Code Playgroud) errMsg在读取输入文件后,我有一个要打印的字符串.验证完成后,如果success==false它调用该方法PrintErrorMessage(string)
//Validations
//First Validation: checks the value of input string realization.
success = Numerical.Check("Realizations", inputs.realizations.ToString(), out ltester, out errMsg);
sb.AppendLine(errMsg);
//Second Validation: checks the value of the input string diameter.
success = Numerical.Check("Pipe Outside Diameter", inputs.pipeOD.ToString(), out dtester, out errMsg);
sb.AppendLine(errMsg);
if (!success)
{
PrintErrorMessage(success, errTitle, sb.ToString());
}
Run Code Online (Sandbox Code Playgroud)
这是我打印错误的方法:
Streamwriter swpt = new Streamwriter(....);
private void PrintErrorMessage(bool success, string errTitle, string errMsg)
{
if (!success)
{
swRpt.WriteLine(errTitle + errMsg);
}
}
Run Code Online (Sandbox Code Playgroud)
问题是这样的:StringBuilder我可以使用ref类型并将其传递给PrintErrorMessage函数并将其附加到那里,而不是在每次验证后附加每一步.