第一次用户 - 希望这是正确的格式:
我想知道我是否可以在ParamaterName上创建SQL DbParameter值.
我目前的代码是:
DbCommand dbCommand = SqlDb.GetStoredProcCommand(uspCommand);
DbParameter ProcessedFileName = dbCommand.CreateParameter();
ProcessedFileName.DbType = DbType.String;
ProcessedFileName.ParameterName = "@FileName";
ProcessedFileName.Value = pstrProcessedFileName;
dbCommand.Parameters.Add(ProcessedFileName);
Run Code Online (Sandbox Code Playgroud)
我想补充一下:
ProcessedFileName.ParameterName = "@FileName1";
ProcessedFileName.ParameterName = "@FileName2";
ProcessedFileName.ParameterName = "@FileName3";
ProcessedFileName.ParameterName = "@FileName4";
Run Code Online (Sandbox Code Playgroud)
与@FileNames从阵列的到来.
我正在为嵌入式设备开发一些固件,该设备使用16位PIC,工作速率为40 MIPS,并以C编程.系统将控制两个步进电机的位置,并始终保持每个电机的步进位置.每个电机的最大位置约为125000步,因此我不能使用16位整数来跟踪位置.我必须使用32位无符号整数(DWORD).电机以每秒1000步的速度移动,我设计了固件,以便在定时器ISR中处理步骤.计时器ISR执行以下操作:
1)将一个电机的当前位置与目标位置进行比较,如果它们是相同的设置,则isMoving标志为false并返回.如果它们不同,则将isMoving标志设置为true.
2)如果目标位置大于当前位置,向前移动一步,然后增加当前位置.
3)如果目标位置小于当前位置,向后移动一步,然后减小当前位置.
这是代码:
void _ISR _NOPSV _T4Interrupt(void)
{
static char StepperIndex1 = 'A';
if(Device1.statusStr.CurrentPosition == Device1.statusStr.TargetPosition)
{
Device1.statusStr.IsMoving = 0;
// Do Nothing
}
else if (Device1.statusStr.CurrentPosition > Device1.statusStr.TargetPosition)
{
switch (StepperIndex1) // MOVE OUT
{
case 'A':
SetMotor1PosB();
StepperIndex1 = 'B';
break;
case 'B':
SetMotor1PosC();
StepperIndex1 = 'C';
break;
case 'C':
SetMotor1PosD();
StepperIndex1 = 'D';
break;
case 'D':
default:
SetMotor1PosA();
StepperIndex1 = 'A';
break;
}
Device1.statusStr.CurrentPosition--;
Device1.statusStr.IsMoving = 1;
}
else
{
switch (StepperIndex1) // MOVE …Run Code Online (Sandbox Code Playgroud) 出于某种原因,当我尝试使用Visual Studio命令提示符将.cs文件编译为.dll时,我会new line constant error因某种原因尝试编译.
之后不喜欢分号+ feet".
知道为什么吗?
这是我的代码:
/* A simple C# class! */
public class Tree
{
public int height = 0;
public void Grow(int h)
{
height += h;
}
public string Message()
{
return "The height of tree1 is:<br/>" + tree1.height + feet";
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个非常大的对象数组,由正常的Get-ChildItem获得,我需要能够通过各种不同的属性对它们进行索引.我已经制作了一组哈希表,它们通过这些属性对它们进行索引,但是现在它只是一堆必须单独构建和管理的集合.有一次,我想到将哈希表添加到基本集合中作为"ByPath""ByGuid"等属性会很好.构建它的代码只会将我已经拥有的各个语句组合在一起:
$items = Get-ChildItem -recurse blahblah
$items | Add-Member -membertype NoteProperty -name "ByGuid" -value (Get-ItemsByGuid)
$items | Add-Member -memberType NoteProperty -name "ByPath" -value (Get-ItemsByPath)
$items
Run Code Online (Sandbox Code Playgroud)
不幸的是,虽然这不会执行,但它没有做任何事情.这些属性存在并且可以通过Get-Member查看,但是在查询时它们始终为null,并在之后设置时抛出.
Property 'ByGuid' cannot be found on this object; make sure it exists and is settable.
At line:1 char:14
+ $items. <<<< ByGuid = $itemsByGuid
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
谎言!
根据我的目的,有什么理由不应该这样做吗?或者有什么理由让我得到奇怪的混合信息?
我们在使用EWS从Exchange删除约会时遇到问题.
我们尝试从这样删除Exchange中的约会
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = CurrentUser; // NetworkCredential
service.Url = new Uri(WebserviceAddress);
service.UseDefaultCredentials = false;
var appointment = Appointment.Bind(service, id);
deletedAppointment.Delete(DeleteMode.MoveToDeletedItems, SendCancellationsMode.SendToAllAndSaveCopy);
Run Code Online (Sandbox Code Playgroud)
我们收到一条消息"无法删除对象"的异常.
捕获到Microsoft.Exchange.WebServices.Data.ServiceResponseException消息=无法删除对象.
Source = Microsoft.Exchange.WebServices StackTrace:Microsoft.Exchange.WebServices.Data.ServiceResponse.InternalThrowIfNecessary()at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest1.Execute() at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalDeleteItems(IEnumerable1 itemIds,DeleteMode deleteMode,Nullable1 sendCancellationsMode, Nullable1 affectedTaskOccurrences,ServiceErrorHandling errorHandling)at Microsoft.Exchange1 sendCancellationsMode, NullableMicrosoft.Exchange.WebServices.Data.Appointment上的Microsoft.Exchange.WebServices.Data.Item.InternalDelete(DeleteMode deleteMode,Nullable1 sendCancellationsMode, Nullable1 affectedTaskOccurrences)中的.WebServices.Data.ExchangeService.DeleteItem(ItemId itemId,DeleteMode deleteMode,Nullable 1 affectedTaskOccurrences).在OurNameSpace.ExchangeCalendar.ViewCalendars.ExchangeMethods.DeleteMeeting(ItemId id)中删除(DeleteMode deleteMode,SendCancellationsMode sendCancellationsMode)InnerException:
如果我们改为尝试使用取消会议
deletedAppointment.CancelMeeting();
Run Code Online (Sandbox Code Playgroud)
我们得到一个例外,消息"用户必须是CancelCalendarItem操作的组织者".这让我很困惑,因为当我检查deletedAppointment对象时,我的电子邮件地址被设置为组织者.
我们创建这样的会议
Appointment appointment = new Appointment(service);
appointment.Subject = subject;
appointment.Body = body; …Run Code Online (Sandbox Code Playgroud) 我有一个有两个类库的解决方案.我正在尝试将整个解决方案从asp.net 3.5转换为4.
现在,这些库位于我的Visual Studio 2008项目文件夹中.我已经安装了VS 2010.我应该将库项目从2008项目文件夹复制到我的2010项目文件夹并在VS 2010中打开吗?
这方面的最佳做法是什么?整个解决方案位于我的VS 2008 Project文件夹中的单个文件夹中,每个应用程序和类库都在它们自己的子文件夹中.
谢谢!
c# asp.net class-library visual-studio-2010 visual-studio-2008
这就是我现在拥有的:
SetText是WPF中Extended Toolkit RichTextbox的一种方法
public void SetText(FlowDocument document, string text)
{
Action<FlowDocument,string> action = SetUIText;
Dispatcher.CurrentDispatcher.BeginInvoke(action,DispatcherPriority.Background, document, text);
}
private void SetUIText(FlowDocument doc, string text)
{
TextRange tr = new TextRange(doc.ContentStart, doc.ContentEnd);
using (MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(text)))
{
tr.Load(ms, DataFormats.Rtf);
}
}
Run Code Online (Sandbox Code Playgroud)
我不想只是将一个额外的SetUIText方法分配给调度程序的委托.
所以我介绍了lambda表达式:
public void SetText(FlowDocument document, string text)
{
Action<FlowDocument, string> action;
action = ( doc, txt) =>
{
TextRange tr = new TextRange(document.ContentStart, document.ContentEnd);
using (MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(text)))
{
tr.Load(ms, DataFormats.Rtf);
}
};
Dispatcher.CurrentDispatcher.BeginInvoke(action,DispatcherPriority.Background, …Run Code Online (Sandbox Code Playgroud) 我似乎无法专门为这条线解决的问题.我找了它.作业是实施棒球运动员球衣号码,击球次数和步行次数的应用.必须使用20列和3行的二维数组.我正在设置线路,为球员的击球次数和结果制作随机数.然而,我得到一个无法从int转换为int []的错误.我已经阅读了几个同样问题的其他问题,似乎没有人帮助我.我可能不理解他们,但我仍然无法解决问题.谢谢你,D
import java.util.Random;
public class Stats
public static void main(String[] args)
{
int[][] array = { { 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 },
{ 10, 11, 12 },
{ 13, 14, 15 },
{ 16, 17, 18 },
{ 19, 20, 21 },
{ 22, 23, 24 },
{ 25, 26, 27 },
{ 28, 29, 30 },
{ 31, 32, 33 },
{ 34, 35, 36 },
{ 37, 38, …Run Code Online (Sandbox Code Playgroud) 我对这个接口和类定义感到有点困惑.有人可能会发光吗?
接口和从中继承的类以这种方式定义:
public abstract class DNum {
}
public abstract class DNum<DIM> : DNum where DIM : DNum<DIM> { //etc...
Run Code Online (Sandbox Code Playgroud)
...... DIM : DNum<DIM>有点让我失望.DIM必须从我们当前定义的类继承,它本身作为泛型参数?这是某种无限递归的定义吗?这里发生了什么?
我正在尝试编写一个程序来模拟纸牌游戏.我有一个名为MagicCard的课程,以及各种扩展卡片的课程,比如card1,card2 ......我想找到一种方法来存储不同卡片的列表/数组(甲板).每个card1,card2 ......都有一个"特殊"效果,它们在播放时会触发,因此需要一个独特的功能,这就是为什么我需要所有不同的子类.很多卡都有类似的属性.如何以合理和方便的方式存放卡座?(我希望可以轻松操作卡座,这样我就可以添加卡片,或者在需要时从卡片中取出卡片).
目前这就是我所拥有的:
//My Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mtgDeckSimulator
{
//General properties of a magic card, extended by individual classes
class cardProperties
{
private String cardName;
/*Mana Array Aranged in the following Order:
* [Colorless,White,Blue,Black,Red,Green] */
private int[] manaCost;
/* Card Type int definitions:
* 0-Artifact
* 1-Creature
* 2-Enchantment
* 3-Instant
* 4-Land
* 5-Planeswalker
* 6-Sorcery
* 7-Tribal */
private int cardType;
public int attack;
public int defense;
private bool permBool; …Run Code Online (Sandbox Code Playgroud) 我无法使用基类对象访问派生类的属性成员.
场景:
public class BaseClass{
public virtual Write(BaseClass data){
}
}
public class DerivedClass : BaseClass{
private string name:
public string Name {get {return name} set {name = value;} }
public override Write(BaseClass data){
Console.println(data.Name); // gives me error here
}
}
Run Code Online (Sandbox Code Playgroud) 有英语(美国)Windows的人可以尝试安装并运行我的程序吗?该程序使用WPF并需要.NET Framework 4.0,并且应该在安装程序期间自动安装此框架.
不幸的是,设置文件或程序看起来很糟糕,因为这次没有来自美国的人运行我的程序(我看到程序在每次启动程序时都要求我的服务器上的更新 - 有一个世界各地的要求很多,但都不是来自美国.
我无法自己尝试,因为我没有英语(美国)Windows,而且我的Windows程序运行完全.我知道这不是关于编程的典型问题,但我不知道在哪里可以找到帮助.
该计划的官方网站是:http://en-us.1-easysoft.com/SK_ABC/index.html
谢谢你的帮助.
托马斯
c# ×9
.net ×3
inheritance ×2
16-bit ×1
32-bit ×1
arrays ×1
asp.net ×1
c ×1
collections ×1
compilation ×1
eclipse ×1
expression ×1
generics ×1
java ×1
lambda ×1
performance ×1
pic ×1
powershell ×1
properties ×1
random ×1
sharepoint ×1
sql ×1
winforms ×1
wpf ×1