在C#里结构体不能用指针typedef struct {
LONG       num_tables;    /* number of tables */
CHAR       **tables;      /* table names */
CHAR       *where;        /* where clause */
} SE_SQL_CONSTRUCT;
LONG SE_sql_construct_alloc
(LONG num_tables,
SE_SQL_CONSTRUCT **constructor);LONG SE_stream_query
(SE_STREAM stream,
SHORT num_columns,
const SE_SQL_CONSTRUCT *construct);SE_SQL_CONSTRUCT sqlc;
long rc;  
rc = SE_sql_construct_alloc (1, &sqlc);
sqlc->where = malloc(20);
sqlc->num_tables = 1;
strcpy (sqlc->tables[0], "cities");
strcpy (sqlc->where, "population < 10000");
num_cols = 3;
rc = SE_stream_query (Stream, num_cols, sqlc);先感谢大家帮忙,问题解决马上揭帖,在线等!

解决方案 »

  1.   

    首先,我觉得上面的C代码好像有些不妥. 存储表名为什么要定义成char **类型的,char *不可以吗?SE_SQL_CONSTRUCT sqlc;
    这里只是定义了一个结构体类型,访问他的成员应该使用sqlc.where语法吧.LONG SE_stream_query
    (SE_STREAM stream,
    SHORT num_columns,
    const SE_SQL_CONSTRUCT *construct);
    函数原型是需要一个const SE_SQL_CONSTRUCT *construct,这里好像是指针吧.
    可在调用的时候,rc = SE_stream_query (Stream, num_cols, sqlc);却给了一个sqlc,具体的类型.Stream是哪个库里面的类型?
      

  2.   

    哦 char **是一个二维结构的字符串数组是吧?
      

  3.   

    用C#中相应的类型把指针类型替换掉就可以了
    如:char*,可以用string来代替
    char**,可以用string[]来代替,或者用ArrayList来代替
      

  4.   

    char ** 就是二维数组
    rc = SE_sql_construct_alloc (1, &sqlc); &sqlc?
    rc = SE_stream_query (Stream, num_cols, sqlc); sqlc?
    怎么写呢?
    Sql.tables[0] ="D131";编译时错误,
      

  5.   

    如果是string类型的话,等号就行了啊
      

  6.   

    是string[]
    SE_SQL_CONSTRUCT Sql =new SE_SQL_CONSTRUCT();
    Sql.tables[0] = "dd";  
    错误: 无法将“"dd"”分配到“Sql.tables[0]”中