小编zey*_*zey的帖子

将图像保存到本地路径时出错

我得到一个图像文件,重新调整大小,然后使用不同的名称保存在同一个文件夹中(文件名+" - 调整大小"),但是我收到此错误

A generic error occurred in GDI+
Run Code Online (Sandbox Code Playgroud)

这是我的调整大小方法的代码,

private  string resizeImageAndSave(string imagePath)
{
    System.Drawing.Image fullSizeImg
         = System.Drawing.Image.FromFile(Server.MapPath(imagePath));
    var thumbnailImg = new Bitmap(565, 290);
    var thumbGraph = Graphics.FromImage(thumbnailImg);
    thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
    thumbGraph.SmoothingMode = SmoothingMode.HighQuality;
    thumbGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
    var imageRectangle = new Rectangle(0, 0, 565, 290);
    thumbGraph.DrawImage(fullSizeImg, imageRectangle);
    string targetPath = imagePath.Replace(Path.GetFileNameWithoutExtension(imagePath),     Path.GetFileNameWithoutExtension(imagePath) + "-resize");
    thumbnailImg.Save(targetPath, ImageFormat.Jpeg); //(A generic error occurred in GDI+) Error occur here !
    thumbnailImg.Dispose();
    return targetPath;
}
Run Code Online (Sandbox Code Playgroud)

我想知道如何解决它?

c# asp.net resize image

5
推荐指数
1
解决办法
2162
查看次数

运行仅数据脚本时出现内存不足异常

当我在SQL Server 2008 R2中运行仅数据脚本时,它显示以下错误:

无法执行脚本
附加信息:
抛出了类型'System.OutOfMemoryException'的异常.(mscorlib程序)

脚本文件的大小是115MB,它只是数据.

当我打开此脚本文件时,它显示:

Document contains one or more extremely long lines of text.  
These lines cause the editor to respond slowly when you open the file .  
Do you still want to open the file ?
Run Code Online (Sandbox Code Playgroud)

我首先运行仅架构脚本,然后运行仅数据脚本.

有没有办法解决这个错误?

sql-server-2008-r2

5
推荐指数
1
解决办法
8714
查看次数

在第一次wav结束之前在NAudio中加入两个wav文件

我使用此函数来连接两个wav文件

 public static void Concatenate(string outputFile, ArrayList sourceFiles)
    {
        byte[] buffer = new byte[1024];
        WaveFileWriter waveFileWriter = null;
        try
        {
            foreach (string sourceFile in sourceFiles)
            {
                using (WaveFileReader reader = new WaveFileReader(sourceFile))
                {
                    if (waveFileWriter == null)
                    {
                        // first time in create new Writer
                        waveFileWriter = new WaveFileWriter(outputFile, reader.WaveFormat);
                    }
                    else
                    {
                        if (!reader.WaveFormat.Equals(waveFileWriter.WaveFormat))
                        {
                            //throw new InvalidOperationException("Can't concatenate WAV Files that don't share the same format");
                        }
                    }
                    int read;
                    while ((read = reader.Read(buffer, 0, buffer.Length)) > 0) …
Run Code Online (Sandbox Code Playgroud)

c# wav naudio

5
推荐指数
1
解决办法
1111
查看次数

@font-face 的离线字体转换器

是否有任何免费的离线字体转换器可以将
\n.ttf(truetype) 格式转换为

\n\n
    \n
  • .eot
  • \n
  • .woff
  • \n
  • .svg
  • \n
\n\n

想用在@font-face喜欢上,

\n\n
@font-face {\nfont-family: 'MyFontFace';\nsrc: url('fonts/MyFont.eot');\nsrc: local('\xe2\x98\xba'), url('fonts/MyFont.woff') format('woff'),  \n    url('fonts/MyFont.ttf') format('truetype'), url('fonts/MyFont.svg')        \n    format('svg');\nfont-weight: normal;\nfont-style: normal;\n           }\n
Run Code Online (Sandbox Code Playgroud)\n

css converters font-face

4
推荐指数
1
解决办法
7718
查看次数

如何验证lambda查询是否返回null

我用lambda从数据库中检索数据

 var obj = DBContext.MyTable.Where(x => x.ID == 2).SingleOrDefault().MyColumn;
Run Code Online (Sandbox Code Playgroud)

实际上,在MyTable2中没有ID.
所以我收到了这条消息.

你调用的对象是空的.

我该如何正确验证?

c# linq lambda

4
推荐指数
1
解决办法
5100
查看次数

IDENTITY_INSERT设置为OFF?

这是我的db脚本,

CREATE TABLE [dbo].[MyTable](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Code] [nvarchar](25) NULL,
[Name] [nvarchar](25) NULL,
[dob] [date] NULL ,
 CONSTRAINT [PK_MyTable] PRIMARY KEY CLUSTERED 
  (
[ID] ASC
  )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF,     
  ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
   ) ON [PRIMARY]
Run Code Online (Sandbox Code Playgroud)

当我插入时,我收到此错误

Cannot insert explicit value for identity column in table 'MyTable' when   
IDENTITY_INSERT is set to OFF.
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

sql-server identity-column

3
推荐指数
2
解决办法
2万
查看次数

SQL Server数据库的兼容级别

我的数据库托管服务器允许恢复兼容级别为90的SQL Server数据库(SQL Server 2005).我的数据库是在本地创建的,兼容级别为100(SQL Server 2008).

所以,我生成了我的数据库脚本(版本2008)并在SQL Server 2005中运行,备份并恢复到我的数据库托管服务器,它的工作原理.目前我确实喜欢它.

然后我发现ALTER DATABASE可以改变数据库喜欢的兼容级别

ALTER DATABASE database_name 
SET COMPATIBILITY_LEVEL = { 90 | 100 | 110 }

 90 = SQL Server 2005
 100 = SQL Server 2008 and SQL Server 2008 R2
 110 = SQL Server 2012
Run Code Online (Sandbox Code Playgroud)

我在SQL Server 2008中使用此脚本转换数据库兼容级别,备份我的数据库并还原到我的数据库托管服务器.但它不起作用.我想知道为什么?有没有更好的方法来解决它?

sql-server compatibility sql-server-2005 sql-server-2008

3
推荐指数
1
解决办法
2万
查看次数

linkbutton没有在asp.net中发布回来

我有很多人linkbutton放在网络表格上,一切正常,直到昨天.但是现在我的ajax扩展器没有工作并且linkbuttons正在回复.我的一些代码是

 <table  width="460px">
    <tr>
        <td colspan="2" 
            style=" color: #C48239; font-style: normal; font-size: 18px; font-family: 'Bookman Old Style'; text-align:center;height:22px;">
           Manage Your Profile</td>
    </tr>
    <tr>
        <td>
            <asp:LinkButton ID="lnk_per_pro" runat="server" CssClass="linkButton" 
                PostBackUrl="~/User/Edit_profile.aspx">Edit Personal Profile</asp:LinkButton> </td>
        <td>
            <asp:LinkButton ID="lnk_par_pro" runat="server"  CssClass="linkButton">Edit Partner's Profile</asp:LinkButton></td>
    </tr>
    <tr>
        <td>
            <asp:LinkButton ID="lnk_con_det" runat="server" CssClass="linkButton" 
                PostBackUrl="~/User/Edit_profile.aspx">Edit Contect Details</asp:LinkButton></td>
        <td>
            <asp:LinkButton ID="lnk_add_photos" runat="server" CssClass="linkButton">Add Photos</asp:LinkButton></td>
    </tr>
    <tr>
        <td>
            <asp:LinkButton ID="lnk_hob" runat="server" CssClass="linkButton" 
                PostBackUrl="~/User/Edit_profile.aspx">Edit Hobbies and Interests</asp:LinkButton></td>
        <td>
            <asp:LinkButton ID="lnk_del_pro" runat="server" CssClass="linkButton">Remove/Delete Profile</asp:LinkButton></td>
    </tr>
</table></center>
</div>
</div><!-- …
Run Code Online (Sandbox Code Playgroud)

c# asp.net webforms linkbutton

3
推荐指数
1
解决办法
1479
查看次数

在linq中选择all by where子句

这是我的代码,

 Name obj = new Name();
 obj = DB.Names.Where(x => x.age == 20 ).SingleOrDefault();
Run Code Online (Sandbox Code Playgroud)

我想要做的就是更新所有的Nameage=20,

 obj.Name = " Mr " + obj.Name ;
 DB.SubmitChanges();
Run Code Online (Sandbox Code Playgroud)

但是.SingleOrDefault()只能返回一个值,我想全力以赴age=20.

c# linq where

2
推荐指数
1
解决办法
1万
查看次数

只读日期时间选择器文本框

我正在使用Telerik DateTimePicker.
这是我的代码,

<telerik:RadDatePicker runat="server" ID="datePicker" Width="150px" >
</telerik:RadDatePicker>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我想设置datePickerS" TextBox以只读.

c# asp.net telerik datetimepicker

2
推荐指数
1
解决办法
4088
查看次数