8 个解决方案
#1
<select name="sex">
<option value="男">男</option>
<option value="女">女</option>
<option value="人妖">人妖</option>
</select>
'接收:
sex_str = request.form("sex")
'保存sex_str到数据库
#2
有C#的吗?
#3
单选按钮,C#也是的呀
#4
楼主参考一下
http://blog.sina.com.cn/s/blog_66c1ec9c0100jrjh.html
把其中一些地方,略微修改一下,就是你问题的答案了。
http://blog.sina.com.cn/s/blog_66c1ec9c0100jrjh.html
把其中一些地方,略微修改一下,就是你问题的答案了。
#5
单选按钮的方法如下:
添加时候默认选中一个:
<input name='sex' type='radio' id='nan' value='男' checked='checked' ><label for='nan'>男</label>
<input name='sex' type='radio' id='nv' value='女' ><label for='nv'>女</label>
修改的时候被选中的代码如下:
<input name='sex' type='radio' id='nan' value='男' <%if rs("sex")="男" then response.Write("checked='checked'")%> ><label for='nan'>男</label>
<input name='sex' type='radio' id='nv' value='女' <%if rs("sex")="女" then response.Write("checked='checked'")%> ><label for='nv'>女</label>
添加时候默认选中一个:
<input name='sex' type='radio' id='nan' value='男' checked='checked' ><label for='nan'>男</label>
<input name='sex' type='radio' id='nv' value='女' ><label for='nv'>女</label>
修改的时候被选中的代码如下:
<input name='sex' type='radio' id='nan' value='男' <%if rs("sex")="男" then response.Write("checked='checked'")%> ><label for='nan'>男</label>
<input name='sex' type='radio' id='nv' value='女' <%if rs("sex")="女" then response.Write("checked='checked'")%> ><label for='nv'>女</label>
#6
4楼正解。
#7
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>男</asp:ListItem>
<asp:ListItem>女</asp:ListItem>
</asp:DropDownList>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace WebApplication3
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private int insert()
{
string _conn = @"Data Source=(Local)/SQLExpress;Initial CataLog=TableName;Integrated Security=True;";
SqlConnection conn = new SqlConnection(_conn);
conn.Open();
string strDDLGender = this.DDLGender.SelectedValue;
string sqlStr = "insert into TableName(userId,Gender) values('01','" + strDDLGender + "');";
SqlCommand cmd = new SqlCommand(sqlStr, conn);
cmd.ExecuteNonQuery();
}
}
}
#8
好的 谢谢你们 !!!非常感谢
#1
<select name="sex">
<option value="男">男</option>
<option value="女">女</option>
<option value="人妖">人妖</option>
</select>
'接收:
sex_str = request.form("sex")
'保存sex_str到数据库
#2
有C#的吗?
#3
单选按钮,C#也是的呀
#4
楼主参考一下
http://blog.sina.com.cn/s/blog_66c1ec9c0100jrjh.html
把其中一些地方,略微修改一下,就是你问题的答案了。
http://blog.sina.com.cn/s/blog_66c1ec9c0100jrjh.html
把其中一些地方,略微修改一下,就是你问题的答案了。
#5
单选按钮的方法如下:
添加时候默认选中一个:
<input name='sex' type='radio' id='nan' value='男' checked='checked' ><label for='nan'>男</label>
<input name='sex' type='radio' id='nv' value='女' ><label for='nv'>女</label>
修改的时候被选中的代码如下:
<input name='sex' type='radio' id='nan' value='男' <%if rs("sex")="男" then response.Write("checked='checked'")%> ><label for='nan'>男</label>
<input name='sex' type='radio' id='nv' value='女' <%if rs("sex")="女" then response.Write("checked='checked'")%> ><label for='nv'>女</label>
添加时候默认选中一个:
<input name='sex' type='radio' id='nan' value='男' checked='checked' ><label for='nan'>男</label>
<input name='sex' type='radio' id='nv' value='女' ><label for='nv'>女</label>
修改的时候被选中的代码如下:
<input name='sex' type='radio' id='nan' value='男' <%if rs("sex")="男" then response.Write("checked='checked'")%> ><label for='nan'>男</label>
<input name='sex' type='radio' id='nv' value='女' <%if rs("sex")="女" then response.Write("checked='checked'")%> ><label for='nv'>女</label>
#6
4楼正解。
#7
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>男</asp:ListItem>
<asp:ListItem>女</asp:ListItem>
</asp:DropDownList>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace WebApplication3
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private int insert()
{
string _conn = @"Data Source=(Local)/SQLExpress;Initial CataLog=TableName;Integrated Security=True;";
SqlConnection conn = new SqlConnection(_conn);
conn.Open();
string strDDLGender = this.DDLGender.SelectedValue;
string sqlStr = "insert into TableName(userId,Gender) values('01','" + strDDLGender + "');";
SqlCommand cmd = new SqlCommand(sqlStr, conn);
cmd.ExecuteNonQuery();
}
}
}
#8
好的 谢谢你们 !!!非常感谢