insert into student values(newid(),@stuNum,@stuName,@stuPassWord, case @stuSex when '男' then 'true' when '女' then 'false' end ,@stuClassNum)
select stuNum,stuName from student where stuName=@stuName
select @name=stuName from student
RETURN @name
create table aaaa ( sex varchar(22) ) go insert into aaaa values('男') insert into aaaa values('男') go using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient;public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlConnection conn=new SqlConnection("server=.;uid=virus;pwd=;database=master"); conn.Open(); SqlCommand comm=new SqlCommand("select * from aaaa",conn); SqlDataReader dr=comm.ExecuteReader(); while (dr.Read()) { this.DropDownList1.Items.Add(dr[0].ToString()); }
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient;public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlConnection conn=new SqlConnection("server=.;uid=virus;pwd=;database=master"); conn.Open(); SqlCommand comm=new SqlCommand("select sex from aaaa",conn); SqlDataReader dr=comm.ExecuteReader(); if(dr!=null) {while (dr.Read()) { if (dr[0].ToString().Equals("男")) { this.DropDownList1.Text = "男"; } else if (dr[0].ToString().Equals("女")) { this.DropDownList1.Text = "女"; } } }
dropdownlist.DataBind();
/*
(
@parameter1 int = 5,
@parameter2 datatype OUTPUT
)
*/
/*@stuNum nchar(10),*/
@stuNum nchar(10),
@stuName nchar(10),
@stuPassWord nchar(10),
@stuSex char(10),
@stuClassNum nchar(10),
@name nchar(10) output
with encryption
AS
SET NOCOUNT off
insert into student values(newid(),@stuNum,@stuName,@stuPassWord,
case @stuSex
when '男' then 'true'
when '女' then 'false'
end
,@stuClassNum)
select stuNum,stuName from student where stuName=@stuName
select @name=stuName from student
RETURN @name
create table aaaa
(
sex varchar(22)
)
go
insert into aaaa values('男')
insert into aaaa values('男')
go
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection conn=new SqlConnection("server=.;uid=virus;pwd=;database=master");
conn.Open();
SqlCommand comm=new SqlCommand("select * from aaaa",conn);
SqlDataReader dr=comm.ExecuteReader();
while (dr.Read())
{
this.DropDownList1.Items.Add(dr[0].ToString());
}
}
}
}
comboBox1.SelectedIndex = 0;
comboBox1.DataBindings.Add(new Binding("SelectedValue", DataSet.Tables,"字段名"));
上面说的不是太清,见谅
TOSTRING() DropDownList1.SelectedValue```
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection conn=new SqlConnection("server=.;uid=virus;pwd=;database=master");
conn.Open();
SqlCommand comm=new SqlCommand("select sex from aaaa",conn);
SqlDataReader dr=comm.ExecuteReader();
if(dr!=null)
{while (dr.Read())
{
if (dr[0].ToString().Equals("男"))
{
this.DropDownList1.Text = "男";
}
else if (dr[0].ToString().Equals("女"))
{
this.DropDownList1.Text = "女";
}
}
}
}
}
}