小编Mic*_*ern的帖子

检查SqlDataReader对象中的列名称

如何检查SqlDataReader对象中是否存在列?在我的数据访问层中,我创建了一个方法,为多个存储过程调用构建相同的对象.其中一个存储过程具有另一个列,其他存储过程不使用该列.我想修改方法以适应每个场景.

我的应用程序是用C#编写的.

.net c# sqldatareader

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

在发布模式下显示Stack Trace for .NET程序集中的行号

有没有办法在发布模式下显示.NET程序集构建/部署的堆栈跟踪中的行?

更新:

我的应用程序分为三个类库项目和一个ASP.NET"网站"项目.我试图追踪的错误是在三个类库项目之一.我只为生成"未设置为对象实例的对象引用"错误的类库项目部署了pdb文件.

行号仍未显示在堆栈跟踪中.我是否需要为所有项目部署pdb文件以获取堆栈跟踪中的行号?

工作方案

为每个应用程序部署pdb文件修复了行号问题.

.net c# stack-trace line-numbers visual-studio

136
推荐指数
5
解决办法
8万
查看次数

C#中的自然排序顺序

任何人都拥有良好的资源或在C#中为FileInfo数组提供自然顺序排序的样本?我正在实现IComparer我的各种界面.

c# sorting file natural-sort

124
推荐指数
11
解决办法
5万
查看次数

确定页面在JavaScript中是否有效 - ASP.NET

确定ASPX页面上的表单在JavaScript中是否有效的最佳方法是什么?

我试图检查使用JavaScript打开的用户控件的验证,window.showModalDialog()并检查服务器端的'Page.IsValid'属性不起作用.我正在使用ASP.NET验证控件进行页面验证.

javascript asp.net validation

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

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

将新列和数据添加到已包含数据的数据表中 - c#

如何DataColumnDataTable已包含数据的对象添加新内容?

伪代码

//call SQL helper class to get initial data 
DataTable dt = sql.ExecuteDataTable("sp_MyProc");

dt.Columns.Add("NewColumn", type(System.Int32));

foreach(DataRow row in dr.Rows)
{
    //need to set value to NewColumn column
}
Run Code Online (Sandbox Code Playgroud)

c# datatable datarow

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

"操作对事务状态无效"错误和事务范围

当我尝试调用包含SELECT语句的存储过程时,我收到以下错误:

该操作对交易状态无效

这是我的电话结构:

public void MyAddUpdateMethod()
{

    using (TransactionScope Scope = new TransactionScope(TransactionScopeOption.RequiresNew))
    {
        using(SQLServer Sql = new SQLServer(this.m_connstring))
        {
            //do my first add update statement

            //do my call to the select statement sp
            bool DoesRecordExist = this.SelectStatementCall(id)
        }
    }
}

public bool SelectStatementCall(System.Guid id)
{
    using(SQLServer Sql = new SQLServer(this.m_connstring)) //breaks on this line
    {
        //create parameters
        //
    }
}
Run Code Online (Sandbox Code Playgroud)

我在问题中创建了另一个与同一数据库的连接的问题吗?

.net c# sql-server transactions transactionscope

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

Android上不支持全局支持PushAsync,请使用NavigationPage - Xamarin.Forms

我在Xamarin.Forms.ContentPage有线到按钮点击事件中有以下方法

public class LoginPage : ContentPage
{
    private Button _loginButton = null;
    private Entry _PasswordInput = null;
    private Entry _UsernameInput = null;

    public LoginPage()
    {
        _UsernameInput = new Entry { Placeholder = "Username" };
        _PasswordInput = new Entry { Placeholder = "Password", IsPassword = true };

        _loginButton = new Button
        {
            Text = "Login",
            BorderRadius = 5
        }

        _loginButton.Clicked += LogIn;

        Content = new StackLayout 
        {
            VerticalOptions = LayoutOptions.Center,
            Children = 
            {
                 _UsernameInput, _PasswordInput, _loginButton, 
            },
            Spacing = …
Run Code Online (Sandbox Code Playgroud)

navigation xamarin.android xamarin xamarin.forms

57
推荐指数
6
解决办法
5万
查看次数

数值的正则表达式模式

我需要一个正则表达式模式才能接受正整数.它也可以接受一个零.

我不想接受带有前导零的小数,负数和数字.

有什么建议?

regex

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

"此错误的创建者未指定原因"例外

我在WCF服务中有以下代码,根据某些情况抛出自定义错误.我得到一个"这个错误的创建者没有指定原因"例外.我究竟做错了什么?

//source code
if(!DidItPass)
{
    InvalidRoutingCodeFault fault = new InvalidRoutingCodeFault("Invalid Routing Code - No Approval Started");
    throw new FaultException<InvalidRoutingCodeFault>(fault);
}

//operation contract
[OperationContract]
[FaultContract(typeof(InvalidRoutingCodeFault))]
bool MyMethod();

//data contract
[DataContract(Namespace="http://myuri.org/Simple")]
public class InvalidRoutingCodeFault
{
    private string m_ErrorMessage = string.Empty;

    public InvalidRoutingCodeFault(string message)
    {
        this.m_ErrorMessage = message;
    }

    [DataMember]
    public string ErrorMessage
    {
        get { return this.m_ErrorMessage; }
        set { this.m_ErrorMessage = value; }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# wcf faults

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