发表于:2005/7/10 11:19:00
#0楼
在脚本中:
char *sql;
char *name;
int age;
sql="";
name="张三";
age=20;
sql="Insert Into Table (CName,CAge) Values([COLOR=red]name[/COLOR],[COLOR=red]age[/COLOR])";
sql="Select * From Table Where CName=[COLOR=red]name[/COLOR] And CAge=[COLOR=red]age[/COLOR]";
//========================================
怎样把 sql 中的 name,age 用变量来赋值?
sql="Select * From Table Where CName=\'";
strcat(sql,name);
strcat(sql,"\')");
这样写SQL语句不执行,并且整型变量 age 怎么办呢?
char *sql;
char *name;
int age;
sql="";
name="张三";
age=20;
sql="Insert Into Table (CName,CAge) Values([COLOR=red]name[/COLOR],[COLOR=red]age[/COLOR])";
sql="Select * From Table Where CName=[COLOR=red]name[/COLOR] And CAge=[COLOR=red]age[/COLOR]";
//========================================
怎样把 sql 中的 name,age 用变量来赋值?
sql="Select * From Table Where CName=\'";
strcat(sql,name);
strcat(sql,"\')");
这样写SQL语句不执行,并且整型变量 age 怎么办呢?