
asp编程中在sql数据库中添加一个外部变量,怎么实现呢?
stringaccount=Session["account"].ToString();//得到从首页传来的数据inti=2;SqlCommandcom=newSqlCo...
string account = Session["account"].ToString();//得到从首页传来的数据
int i = 2;
SqlCommand com = new SqlCommand("insert into 学生分组 (学生分组编号,组长编号) VALUES (i,account) ", con);
i++;
我是这样实现的,但是不能添加到数据库中去。 展开
int i = 2;
SqlCommand com = new SqlCommand("insert into 学生分组 (学生分组编号,组长编号) VALUES (i,account) ", con);
i++;
我是这样实现的,但是不能添加到数据库中去。 展开
1个回答
展开全部
你可以使用表单提交,给你个例子:
<form method="post" action="simpleform.asp">
<p>First Name: <input type="text" name="fname" /></p>
<p>Last Name: <input type="text" name="lname" /></p>
<input type="submit" value="Submit" />
</form>
sql="insert into 名,姓 VALUES (fname,lname) "
rs.open sql,conn
<form method="post" action="simpleform.asp">
<p>First Name: <input type="text" name="fname" /></p>
<p>Last Name: <input type="text" name="lname" /></p>
<input type="submit" value="Submit" />
</form>
sql="insert into 名,姓 VALUES (fname,lname) "
rs.open sql,conn
追问
有一个是常量,可否私聊呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询