在尝试执行此查询时:
var query = from dpr in ctx.DPR_MM
join q in ctx.QOT on dpr.DPR_QOT_ID equals qot_id
join p in ctx.PAY_MM on new { q.QOT_SEC_ID, dpr.DPR_TS } equals new { p.PAY_SEC_ID, p.PAY_DATE }
where q.QOT_ID = qot_id
select new
{
dpr.dpr_ts,
dpr.dpr_close,
pay.First().pay_dividend
};
Run Code Online (Sandbox Code Playgroud)
我收到这个错误:
join子句中某个表达式的类型不正确.调用"加入"时类型推断失败.
QOT_SEC_ID
是类型decimal
和 PAY_SEC_ID
类型int32
.我不允许在表格中更改它.
无论我做什么,我都无法在模特的属性中改变它.我试图转换像这样的类型:
join p in ctx.PAY on new { sec_id = (Int32)(q.QOT_SEC_ID), dpr.DPR_TS } equals new { sec_id = (Int32)p.PAY_SEC_ID, p.PAY_DATE }
Run Code Online (Sandbox Code Playgroud)
但得到上面的错误.
我正在尝试使用以下代码绘制jqplot:
<script lang="javascript" type="text/javascript">
$(document).ready(function () {
var line1 = var line1 =[["10.01.2011",3.9990],["11.01.2011",3.9910],["12.01.2011",4.0140],["13.01.2011",3.9940],["14.01.2011",3.9050],["17.01.2011",3.9340],["18.01.2011",3.9520],["19.01.2011",3.8980],["20.01.2011",3.8690],["21.01.2011",3.8830],["24.01.2011",3.8550],["25.01.2011",3.8480],["26.01.2011",3.8190],["27.01.2011",3.8440],["28.01.2011",3.8260],["31.01.2011",3.8060],["01.02.2011",3.7970],["02.02.2011",3.8060],["03.02.2011",3.8110],["04.02.2011",3.8640],["07.02.2011",3.8750],["08.02.2011",3.8640],["09.02.2011",3.8480],["11.02.2011",3.8570],["14.02.2011",3.8880],["15.02.2011",3.88],["16.02.2011",3.8520],["17.02.2011",3.8590],["18.02.2011",3.8690],["22.02.2011",3.8440],["23.02.2011",3.8080],["24.02.2011",3.7410],["25.02.2011",3.7460],["28.02.2011",3.7550],["01.03.2011",3.7520],["02.03.2011",3.76],["03.03.2011",3.7420],["04.03.2011",3.7430],["07.03.2011",3.7330],["08.03.2011",3.7260],["09.03.2011",3.76],["10.03.2011",3.7910],["11.03.2011",3.79]];
var plot1 = $.jqplot('chart1', [line1], {
title: 'Default Date Axis',
axes: { xaxis: { renderer: $.jqplot.DateAxisRenderer } },
series: [{ lineWidth: 4, markerOptions: { style: 'square' } }]
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
它是通过一些C#代码生成的,但最后页面源看起来像呈现的代码.未绘制图表,jquery抛出此异常:No plot target specified
.
有什么线索吗?
我正在尝试循环游标.当我在pl/sql中直接执行命令(表示为sql - 见下文)时,我得到的结果集包含更多行.但是当我运行这段代码时,我只得到一行:
using (OracleConnection conn = new OracleConnection(connstring))
{
conn.Open();
string sql = "select close, ts from dpr@price where qot_id=2029543939 and ts>='" + start + "' and ts<='" + end + "'";
using (OracleCommand comm = new OracleCommand(sql, conn))
{
using (OracleDataReader rdr = comm.ExecuteReader())
{
while (rdr.Read())
{
Console.WriteLine(rdr.GetOracleDecimal(0));
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
代码不会抛出任何异常(至少不是以通常的方式;我的意思是它不会停止或写入堆栈跟踪).但是我可以在调试时通过reader Object看到这些行(我不认为它在这里是相关的,但显示输出"以防万一"):
InitialLONGFetchSize = 'rdr.InitialLONGFetchSize' threw an exception of type 'System.NullReferenceException'
InitialLOBFetchSize = 'rdr.InitialLOBFetchSize' threw an exception of type 'System.NullReferenceException'
Run Code Online (Sandbox Code Playgroud)
结果应该只有类型DateTime
和Number (10,4) …
我收到这个警告:
warning: assignment discards qualifiers from pointer target type
Run Code Online (Sandbox Code Playgroud)
问题是,事实symbolP
并非如此const
.我不想const char *symbolP
每次都在循环中创建.我怎样才能以更好的方式解决它.这里的片段:
int getList(OCI_Connection* cn)
{
OCI_Statement* st;
OCI_Resultset* rs;
char *symbolP;
char *query ="SELECT ..";
st = OCI_StatementCreate(cn);
OCI_ExecuteStmt(st, query);
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
//here comes the warning:
symbolP = OCI_GetString(rs,1);
}
return 1;
}
Run Code Online (Sandbox Code Playgroud) 我正在寻找能够在逗号后将数字四舍五入或截断为 2 位数的任何方法。我试过round
,trunc
和to_char
。但是没有得到我想要的。
select round(123.5000,2) from dual;
select round(123.5000,2) from dual;
Run Code Online (Sandbox Code Playgroud)
工作正常,但是当我在逗号后的第二位数字为零时,输出编号中的逗号后只有一位数字
select to_char(23.5000, '99.99') from dual;
Run Code Online (Sandbox Code Playgroud)
工作正常,但如果逗号前的数字有 3 位数字,我将得到 '###' 作为输出。除此之外,我一开始就有空间。有什么明确的方法可以删除这些空格吗?
我正在寻找一种方法来始终获得逗号后两位数字和所有数字(1,10,100 等)的数字。
我可以将数组从perl传输到c而不用任何东西到hdd吗?我可以在perl中生成一个数组,将其保存在文件中并在c中读取.但是只能在内存中执行此操作吗?
我正在尝试复制 x 字节。计算并打印尺寸(见下文)。我使用 memcpy 复制计数的字节数。但结果我有时会得到更长的值。怎么了?
这是一些代码:
size_t symlen = tmpP - cp;
char * triP = malloc(symlen);
printf("mallocated %zu\n", symlen) ;
memcpy (triP, tmpP - (symlen) , symlen);
printf(">>VAL %s<<\n", triP);
Run Code Online (Sandbox Code Playgroud)
这是一些输出,您可以看到,该值长达 15 个字符。
mallocated 15
>>VAL 558657,1033,8144399,814<<
mallocated 15
>>VAL 558657,1033,8144399,814<<
Run Code Online (Sandbox Code Playgroud) 我一直收到这个错误:
*** glibc detected *** /s/httpget: double free or corruption (fasttop): 0x00000000005352a0 ***
Run Code Online (Sandbox Code Playgroud)
我真的没有看到,我有两次免费.所以我猜它是因为腐败...我在附加的代码中做了一些评论,所以请看看那里,更好地理解问题.
Here backtrace:
#5 0x0000000000401077 in processXML (
start=0x506010 "<I k=\"506012,148,1\" b=\"158\" n=\"11393\" \n</I>\n<I k=\"2553367,257,814\" b=\"2781\" n=\"43020\" "1\" td=\"15\" d=\"20131204\" t=\"144734\" z=\"110\">\n<P k=\"33,3,0\" gn=\"1\" v=\"18.65\"/>\n<P k=\"33,3,1\" v=\"18.65 >\n</I>\n<I "..., stop=0x50af1a "<I k=\"506012,148,1\" b=\"158\" n=\"11393\" ", t=0x51ecb0) at cli.c:178
#6 0x0000000000401669 in main () at cli.c:292
Run Code Online (Sandbox Code Playgroud)
这里的代码:
void processXML(char *start, char *stop, GTree* t)
{
if (start == NULL)return;
start = strstr(start,START);
char * cp = start ; …
Run Code Online (Sandbox Code Playgroud)