小编Ham*_*lis的帖子

FastCGI进程意外退出

我试图在Windows 2008服务器上通过FastCGI运行PHP.

我按照这个安装文档http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis7/进行了检查,并检查了我完成了多次相关的步骤.

但是,当我尝试执行php页面时,我出现以下错误:

HTTP错误500.0 - 内部服务器错误C:\ PHP\php-cgi.exe - FastCGI进程意外退出

php windows-server-2008

28
推荐指数
6
解决办法
9万
查看次数

如何在XML中编码特殊字符

我的字符串XML包含一系列特殊字符:

&
egrave;
&
rsquo;
&
rsquo;
&
rsquo;
&
ldquo;
&
rdquo;
&
rsquo
&
agrave;
&
agrave;
Run Code Online (Sandbox Code Playgroud)

我需要在DB中插入字符串中替换此特殊字符,我尝试使用System.Net.WebUtility.HtmlEncode但没有成功,你能帮助我吗?

string sql = "insert into rss (title, description, link, pubdate) values (?,?,?, " +
             " STR_TO_DATE(?, '%a, %d %b %Y %H:%i:%s GMT'));";

OdbcCommand command;
OdbcDataAdapter adpter = new OdbcDataAdapter();
connection.Open();
command = new OdbcCommand(sql, connection);
command.Parameters.AddWithValue("param1", System.Net.WebUtility.HtmlEncode(xmlTitle.InnerText.ToString()));
command.Parameters.AddWithValue("param2", System.Net.WebUtility.HtmlEncode(xmlDescription.InnerText.ToString()));
command.Parameters.AddWithValue("param3", System.Net.WebUtility.HtmlEncode(xmlLink.InnerText.ToString()));
command.Parameters.AddWithValue("param4", System.Net.WebUtility.HtmlEncode(xmlPubDate.InnerText.ToString()));
adpter.InsertCommand = command;
adpter.InsertCommand.ExecuteNonQuery();
connection.Close();
Run Code Online (Sandbox Code Playgroud)

c# xml

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

java.lang.IllegalStateException:ArrayAdapter要求资源ID为TextView

我试过这个教程http://windrealm.org/tutorials/android/android-listview.php "一个简单的Android ListView示例"

但是在我的Eclipse测试中,我在android应用程序中崩溃了.

在LogCat我是这样的:

04-11 20:17:24.170: E/AndroidRuntime(7062): 
java.lang.IllegalStateException: ArrayAdapter requires the resource ID
to be a TextView
Run Code Online (Sandbox Code Playgroud)

撞车为什么?

class java

private ListView mainListView;
private ArrayAdapter<String> listAdapter;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mains);

        mainListView = (ListView) findViewById(R.id.mainListView);

        String[] xRemote = Remote.split(";");

        ArrayList<String> planetList = new ArrayList<String>();

        planetList.addAll(Arrays.asList(xRemote));

        listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow,
                planetList);

        listAdapter.addAll(xRemote);

        mainListView.setAdapter(listAdapter);
Run Code Online (Sandbox Code Playgroud)

mains.xml

<?xml version="1.0" encoding="utf-8"?>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">

        <ListView android:layout_width="fill_parent" 
          android:layout_height="fill_parent" 
          android:id="@+id/mainListView">
        </ListView      
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

simplerow.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

java android

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

在发送HTTP标头后,服务器无法附加标头c#excel inline

我有这个问题,试图返回一个excel内联响应.

我通过帮助编码页面搜索了这个问题的答案,但找不到有用的东西.

我做了一个简化的例子,说明我在下面做的事情.这个问题总是会发生.

这行错误:

Line 56:         Response.AddHeader("content-disposition",
Run Code Online (Sandbox Code Playgroud)

代码背后:

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        PleaseWait();
        Call();
    }

    protected void Call()
    {
        strSql = "SELECT * FROM ....... ; ";

        SqlCommand cmd = new SqlCommand(strSql);
        DataTable dt = GetData(cmd);

        GridView GridView1 = new GridView();
        GridView1.AllowPaging = false;
        GridView1.DataSource = dt;
        GridView1.DataBind();

        Response.Clear();
        Response.Buffer = true;
        Response.BufferOutput = true;
        Response.ClearHeaders();

        Response.AddHeader("content-disposition",
         "attachment;filename= "Output.xls");
        Response.Charset = "";
        Response.ContentType = "application/vnd.ms-excel";
        StringWriter sw = new StringWriter(); …
Run Code Online (Sandbox Code Playgroud)

c# excel

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

如何从c#中的DataTable获取特定列值

如何从c#中的DataTable获取特定列值

我的代码C#有问题.

我需要从DataTable中读取特定的列值.

我尝试使用此解决方案但没有成功,因为输出是在查询(文件)中选择的列的名称,而不是字段数据库的值.

我非常感谢您在解决这个问题时能给我的任何帮助.

这是我的代码:

public DataTable GridViewBind()
{
    using (OdbcConnection cn =
        new OdbcConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString))
    {    
        sql1 = " SELECT FILE FROM tbl_A WHERE Id = 1; ";


        using (OdbcDataAdapter command =
            new OdbcDataAdapter(sql1, cn))
        {
            try
            {
                cn.Open();

                dset = new DataSet();
                dset.Clear();
                command.Fill(dset);
                DataTable dt = dset.Tables[0];
                GridView1.DataSource = dt;                    
                GridView1.DataBind();

                Response.Write(dt.Columns[0].ToString());

                return dt;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("operation failed!", ex);
            }
            finally
            {
                if (command != null) …
Run Code Online (Sandbox Code Playgroud)

c# datatable

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

未知的服务器标签cc1:ToolkitScriptManager

我正在使用ajaxcontrols并且所有控件都运行良好但是我没有找到任何名为的控件,ToolkitScriptManager所以我刚刚在.html页面中复制了这个标签.

我该怎么办?托管服务器中的框架版本为2.

我的Web.config文件是:

<pages>
  <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
  </controls>
</pages>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" TagPrefix="cc1"/>
        <bindingRedirect oldVersion="3.5.0.0" newVersion="1.0.61025.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
Run Code Online (Sandbox Code Playgroud)

Aspx页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CS.aspx.cs" Inherits="CS" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .Star
        {
            background-image: url(images/Star.gif);
            height: 17px;
            width: 17px;
        }
        .WaitingStar
        {
            background-image: url(images/WaitingStar.gif);
            height: 17px;
            width: 17px; …
Run Code Online (Sandbox Code Playgroud)

c# ajaxcontroltoolkit

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

在回发时清除 QueryString

简单的问题,但我不知道该怎么做。我有一个带有 GridView 的页面,它最初填充了一个查询字符串。

获得查询字符串值后,我不需要查询字符串,因为我使用 DropDownList 的值来填充 GridView。

我怎样才能摆脱它?

回发不会清除它,它只是继续标记。

我试过 Request.QueryString.Clear,但得到“只读”错误。

我将不胜感激您在解决此问题时能给我的任何帮助。

编辑 1

using System;
using System.Configuration;
using System.Data;
using System.Data.Odbc;
using System.Globalization;
using System.Threading;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;

public partial class GV : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            my_DDL();
            GridViewBind();
        }
    }

    protected void my_DDL()
    {
      ....... 
    }

    protected void DDL_SelectedIndexChanged(object sender, EventArgs e)
    {
        PropertyInfo Isreadonly = typeof(System.Collections.Specialized.NameValueCollection).GetProperty("IsReadOnly", BindingFlags.Instance | BindingFlags.NonPublic);
        Isreadonly.SetValue(Request.QueryString, false, null);
        Request.QueryString.Clear(); 
    }

    public DataTable …
Run Code Online (Sandbox Code Playgroud)

.net c# postback query-string

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

计数GridView中选中的复选框

我在GridView中有几个复选框和一个按钮。

我需要对选定的复选框进行计数,并使用选定的复选框数量更新doTable DB MySQL的字段计数器。

我尝试了此解决方案,但对于选中的复选框,我已将此输出更新,例如,选中了3个复选框。

counter
1
2
3
Run Code Online (Sandbox Code Playgroud)

如何执行此输出?

counter
3
3
3
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激。

protected void btnUpdate_Click(object sender, EventArgs e)
{
    int counter = 0;

    foreach (GridViewRow row in GridView1.Rows)
    {
        CheckBox chkRow = (row.Cells[0].FindControl("chkSelect") as CheckBox);

        if (chkRow.Checked)
        {
            counter = counter + 1;
            UpdateProduct(counter);

        }
    }


private void UpdateProduct(int counter)
{
    string sql = String.Format(@"Update doTable set 
                                 counter = {0}; ",
                                 counter.ToString());
    try
    {
        conn.Open();
        OdbcCommand cmd = new OdbcCommand(sql, conn);
        cmd.ExecuteNonQuery();
    }
    catch (Exception ex)
    { …
Run Code Online (Sandbox Code Playgroud)

c# asp.net checkbox

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

从C#中的List <string>中删除重复项

从C#中的List中删除重复项

我有一个数据读取器从数据库中读取字符串.

我使用List来聚合从数据库读取的字符串,但是我在这个字符串中有重复项.

任何人都有一个快速方法从C#中的通用列表中删除重复项?

List<string> colorList = new List<string>();

    public class Lists
    {
        static void Main()
        {
            List<string> colorList = new List<string>();
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            colorList.Add(variableFromDB.ToString());

                    foreach (string color in colorList)
                    {
                      Response.Write(color.ToString().Trim());
                    }
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# asp.net list

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

C#将字符串转换为日期yyyy-MMM

我需要在输出日期转换此输入字符串,我尝试了这个解决方案:june 20142014-06

DateTime dt;
DateTime.TryParseExact(Input.ToString(), "MMM yyyy", 
                       CultureInfo.InvariantCulture, DateTimeStyles.None, out dt);

Response.Write(dt.ToString("yyyy MMM"));
Run Code Online (Sandbox Code Playgroud)

但在输出中我有0001 jan,为什么?

我非常感谢您在解决这个问题时能给我的任何帮助.

先感谢您.

c# string date

0
推荐指数
2
解决办法
155
查看次数