Tag: visual studio 2010

我如何使用Profilebase类?

我尝试使用asp.net配置文件,我尝试使用ProfileBaseinheritance public class dort_islem : ProfileBase { public int ilk_sayi { get; set; } public int ikinci_sayi { get; set; } } 但如果我尝试使用这些代码Default.aspx: alt text http://sofzh.miximages.com/c%23/zn5v60.gif 我如何从dort_islem类中看到ilk_sayi? 问候….

VS2010 – 启动选项命令行参数中的项目宏变量

在项目设置中,在“调试”选项卡上,有没有办法在命令行参数框中使用项目宏变量? 我知道你不能直接使用它们因为它们没有扩展但是有一个聪明的解决方案吗? 编辑:我正在使用C#项目。

web.config转换从web.template.xml无法正常工作

我正在尝试按照此处所述进行web.config转换。 我们已经在其他项目中使用了这种方法,它没有问题,但在这个新项目上没有。 这是我试过没有成功的测试 在我得到项目名称错误的情况下更改wpp.targets文件的名称。 我知道我正在使用的当前工作,因为它是唯一一个导致从web.template.xml重建web.config的转换工作。 只有子模板不起作用。 尝试使用xdt:Locator =“Match(name)” 尝试.config扩展与.xml,我们的其他项目使用.xml 配置管理器设置为我正在使用的项目使用“测试”配置。 web.template.Test.xml对我要替换的部分有xdt:Transform =“Replace” web.template.xml具有占位符 尝试从wpp.targets中删除“CopyWebTemplateConfig”部分,如下面链接的堆栈问题所示。 我们的其他项目有这个和“PropertyGroup”部分注释掉,我尝试了两种组合。 我已经多次阅读了上面的链接和这个相关的堆栈问题 ,但看不出是什么问题。 注意发布转换确实有效。 它创建一个web.template.xml文件,其中包含来自web.template.Test.xml的值,但不会像wpp.targets指示的那样创建web.config.xml。 所以这似乎是让构建转换正常工作的问题。 任何人都知道缺少什么? wpp.targets $(PrepareForRunDependsOn); UpdateWebConfigBeforeRun; web.template.xml …. …. …. web.template.Test.xml … MSBuild输出 Target “UpdateWebConfigBeforeRun: (TargetId:143)” in file “C:\…\Project.wpp.targets” from project “C:\…\Project.csproj” (target “PrepareForRun” depends on it): Task “Message” (TaskId:93) Configuration: Test: Web.template.Test.xml (TaskId:93) Done executing task […]

entity framework和DbContext – 对象跟踪

我对Entity Framework中DbContext的使用有点困惑。 这是我很困惑的场景。 我使用dbcontext中的linq查询来获取数据。 就像是: List transactions = DefaultContext.Transactions.ToList(); 然后我直接在数据库中更新该查询中返回的一个事务中的列。 然后我再打电话: List transactions = DefaultContext.Transactions.ToList(); 当列表返回这次时,它不会反映我在运行update语句时所做的更新/更改,除非我遍历所有事务并重新加载它们: foreach (DbEntityEntry item in DefaultContext.ChangeTracker.Entries()) { DefaultContext.Entry(item.Entity).Reload(); } 这是正常的行为吗? 我假设在我的初始查询中,它们被附加到对象上下文。 然后当我第二次查询时,它不会访问数据库,只是从对象上下文中提取实体,除非我清除/分离或单独重新加载所有实体。

InvalidOperationException未关闭连接。 连接的当前状态是打开的

为什么此代码会抛出无效的操作exception? private SqlCommand cmd; // initialized in the class constructor public void End(string spSendEventNotificationEmail) { try { cmd.CommandText = spSendEventNotificationEmail; cmd.Parameters.Clear(); cmd.Parameters.Add(“@packetID”, SqlDbType.Int).Value = _packetID; cmd.Parameters.Add(“@statusID”, SqlDbType.Int).Value = _statusID; cmd.Parameters.Add(“@website”, SqlDbType.NVarChar, 100).Value = Tools.NextStep; cmd.Connection.Open(); cmd.ExecuteNonQuery(); } finally { cmd.Connection.Close(); cmd.Parameters.Clear(); cmd.Dispose(); } endCall = true; }

将绑定的combobox添加到datagridview

该场景与http://arsalantamiz.blogspot.com/2008/09/binding-datagridview-combobox-column.html几乎相同。 但我不能让它在c#上工作…… 我有两个表的mySql数据库:1。协议2. pcapdata 在协议表中,我有两个字段:idprotocols和protocolName 在pcaps表中我有wizardProtocol(它与idprotocols字段“链接”) 我想要得到的是一个包含名称的combobox,它将取代向导协议字段。 接下来,如果用户更新“名称”combobox,则wizardProtocol将相应地更改(因此我将能够相应地更新数据库中的更改)。 现在,在网上阅读了一些信息后:我写了以下代码: public void Bind(ref DataGridView dataGridView) { try { mySqlDataAdapter = new MySqlDataAdapter(SELECT_ALL_PCAP, _con); mySqlCommandBuilder = new MySqlCommandBuilder(mySqlDataAdapter); mySqlDataAdapter.UpdateCommand = mySqlCommandBuilder.GetUpdateCommand(); mySqlDataAdapter.DeleteCommand = mySqlCommandBuilder.GetDeleteCommand(); mySqlDataAdapter.InsertCommand = mySqlCommandBuilder.GetInsertCommand(); dataSet = new DataSet(); mySqlDataAdapter.Fill(dataSet, “pcap”); MySqlDataAdapter adp2 = new MySqlDataAdapter(SELECT_ALL_PROTOCOL, _con); MySqlCommandBuilder builder = new MySqlCommandBuilder(adp2); adp2.UpdateCommand = builder.GetUpdateCommand(); […]

VS 2010使用自定义计数器加载测试结果

我是Visual Studio 2010的负载测试(通常是测试)的新手,我正在处理几个问题。 我的问题是,有没有可能在负载测试结果上添加自定义测试变量? 我有以下UnitTest: [TestMethod] public void Test() { Stopwatch testTimer = new Stopwatch(); testTimer.Start(); httpClient.SendRequest(); testTimer.Stop(); double requestDelay = testTimer.Elapsed.TotalSeconds; } 许多LoadTests使用此UnitTest,我想将requestDelay变量添加到负载测试结果,因此我可以像所有其他负载测试计数器一样获得Min,Max和Avg值(例如测试响应时间)。 那可能吗?

如何从另一个类访问winform组件?

我有一个带有一个按钮和两个标签的表单 我有一个名为myCounter的独立类 我希望myCounter类能够通过名为changeColor的方法访问表单中的标签。 如何在此课程中提供标签 表格 public partial class Form1 : Form { public Form1() { InitializeComponent(); } public Color colTurn { get { return lblp1Turn.BackColor; } set { lblp1Turn.BackColor = value; } } private void Form1_Load(object sender, EventArgs e) { } } class级 class myCounter { private readonly Form1 Board; public myCounter(Form1 Board) { this.Board […]

ASP.NET Web服务模板不存在?

我使用.Net framework 4完整安装了Visual Studio 2010 。 我想创建我的第一个Web服务。 但不存在Web服务模板。 在visual studio 2010中,我转到File – > New Web Site菜单,但在New Web Site对话框中不存在ASP.NET Web Service模板。 如何创建Web服务?

Gridview获取Checkbox.Checked值

我有一个GridView,其中有10个列由CheckBoxes填充。 但是使用FindControl()是否有办法通过循环获取CheckBox.Checked值? 现行代码: if (e.CommandName == “updaterow”) { int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = GridView1.Rows[index]; // TableCell BranchCode = selectedRow.Cells[0]; CheckBox cb101 = (CheckBox)selectedRow.FindControl(“cb101”); CheckBox cb102 = (CheckBox)selectedRow.FindControl(“cb102″); //…and so on } ASPX代码: <asp:CheckBox runat="server" id="cb101" AutoPostBack="false" Checked='’ Enabled=”/> ….and so on