阅读:2262回复:0
[求助]关于C API添加数据的一个错误<P>代码如下,</P> <P>SE_CONNECTION handle;<BR> SE_ERROR Connect_error; //错误状态<BR> SE_STREAM stream; //数据流<BR> CHAR tableName[32];//表名<BR> CHAR **attrs; //属性列<BR> SE_SHAPE shape; //形<BR> SE_COORDREF coordref; //坐标系引用<BR> SE_POINT pt[1]; //坐标点<BR> SE_LAYERINFO layer; //层信息</P> <P> /*************************连接数据库********************************/<BR> LONG rc = SE_connection_create(Server,serverInstance, dataBase, userName, pwd, ;Connect_error, ;handle);<BR> if ((rc != SE_SUCCESS) ;; (rc != SE_FINISHED))<BR> {<BR> return check_error(handle, NULL, rc, "SE_connection_create"); <BR> }</P> <P> //得到要操作的业务表 <BR> strcpy(tableName,table);<BR> attrs = (CHAR **)malloc(sizeof(CHAR *) * size);<BR> <BR> for (SHORT n = 0; n < size; n++)<BR> {//字段名赋值<BR> attrs[n] = data[n].EleName;<BR> }<BR> <BR> /* 创建数据流连接 */<BR> rc = SE_stream_create (handle, ;stream);<BR> if ((rc != SE_SUCCESS) ;; (rc != SE_FINISHED))<BR> {<BR> return check_error (handle, NULL, rc, "SE_stream_create");<BR> }<BR> <BR> //初始化stream-->table<BR> rc = SE_stream_insert_table(stream, table, size, (const CHAR**)attrs);</P> <P>但在执行到最后一句时rc=-395,错误描述是:The Requested operation is invalid on a closed state.</P> <P>不知各位以前是否碰到过,怎么解决?谢谢!</P> |
|