我有一个值列表,如"12000","12345","123456",需要转换为货币("120.00","123.45","1234.56").我知道的唯一方法是将值转换为字符串,将第一个strlen() - 2个字符复制到一个字符串(美元),将剩余的两个数字复制到另一个字符串(美分),然后将它们写为以下内容:
printf("%s.%s", dollars, cents);
Run Code Online (Sandbox Code Playgroud) IF NOT EXISTS(SELECT * FROM MyTable WITH(nolock) WHERE Key = 'MyKey')
INSERT MyTable(Key) Values('MyKey')
Run Code Online (Sandbox Code Playgroud)
如果表中不存在该值,查询是否会获取锁定?
我试图使用powershell来获取文件的文件版本.如果我右键单击该文件并查看该版本,则会显示一个值.以下是我尝试这样做的方法:
$path = "MSDE2000A";
$info = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($path);
Run Code Online (Sandbox Code Playgroud)
这是它抛出的异常信息:
Exception calling "GetVersionInfo" with "1" argument(s): "MSDE2000A.exe"
At line:1 char:58
+ $f = [system.diagnostics.fileversioninfo]::getversioninfo <<<< ("MSDE2000A.exe")
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Run Code Online (Sandbox Code Playgroud)
我检查的每个文件都有相同的结果.但是,如果我的路径是c:\ windows \notepad.exe(如示例中所示),它将按预期工作.这是怎么回事?
我有一个ASP.Net MVC应用程序.我试图将数据发布到一个动作,然后只是渲染输出.我有一个页面,您可以在其中查看产品,因此www.mysite.com/product/details/1显示了该产品.在这个页面上,我通过RenderAction()渲染一个包含一些定价逻辑的局部视图.我希望用户选择一些选项,然后让jquery发布选项以获得新价格.
但是,当我打电话的时候
$.post({
url : "price/getprice",
data : {"options" : chosenOptions},
success : function(data) {
$("#price").text(data);
}
});
Run Code Online (Sandbox Code Playgroud)
该网址发布到该网址www.mysite.com/product/details/price/getprice不存在.我已经尝试发布到"〜/ price/getprice /",但它做了同样的事情.为什么不去我的PriceController的GetPrice(FormCollection表单)动作?
这应该发布到www.mysite.com/price/getprice.当我查看firebug中的Net选项卡时,它说它发布了这个:
http://localhost:42427/Product/Details/%5Bobject%20Object%5D
Run Code Online (Sandbox Code Playgroud)
如果我查看Firebug中的响应,应用程序将抛出异常:
参数字典包含非可空类型'System.Int32'的参数'id'的空条目,用于'PrintPlaceWebsite.Controllers.ProductController'中方法'System.Web.Mvc.ActionResult Details(Int32)'.
但是我不是要试着去那个地方所以......呃.
说我有一些Windows方法和结构:
struct SomeStruct{
int foo;
int bar;
int baz;
int bat;
}
SomeMethod(int a,int wParam, int lParam)
{
SomeStruct s;
// get lParam into SomeStruct
}
Run Code Online (Sandbox Code Playgroud)
如何将lParam变为SomeStruct变量?我想我需要这样的东西(但是可以随意指出我的无知):
SomeMethod(int a, int wParam, int lParam)
{
SomeStruct *s; //declare struct variable
s = lParam; //assign integer value as pointer to struct
printf("the value of s.foo is %d", s.foo); //print result
}
Run Code Online (Sandbox Code Playgroud) c ×2
asp.net-mvc ×1
currency ×1
jquery ×1
jquery-post ×1
powershell ×1
sql-server ×1
winapi ×1