测试页面时,RadioButtonList1没有默认值。直接输出reader2["heart"]的值不为空。 protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn1 = new SqlConnection(ConfigurationManager.ConnectionStrings["BOZConnectionString"].ConnectionString);
try
{
SqlCommand cmd1 = new SqlCommand("SELECT id, title, diary_time, heart FROM article WHERE (GUID = @GUID)", conn1);
cmd2.Parameters.Add("@GUID",SqlDbType.UniqueIdentifier).Value = new Guid(Request.QueryString["GUID"]);
conn1.Open();
SqlDataReader reader1 = cmd1.ExecuteReader();
while (reader1.Read())
{
TextBox1.Text = reader1["title"].ToString();
TextBox2.Text = reader1["diary_time"].ToString();
RadioButtonList1.SelectedValue = reader2["heart"].ToString();
Response.Write(reader2["heart"].ToString());
}
reader1.Close();
} catch (Exception ex)
{
Response.Write(ex.Message);
} finally
{
conn1.Close();
}
}
{
SqlConnection conn1 = new SqlConnection(ConfigurationManager.ConnectionStrings["BOZConnectionString"].ConnectionString);
try
{
SqlCommand cmd1 = new SqlCommand("SELECT id, title, diary_time, heart FROM article WHERE (GUID = @GUID)", conn1);
cmd2.Parameters.Add("@GUID",SqlDbType.UniqueIdentifier).Value = new Guid(Request.QueryString["GUID"]);
conn1.Open();
SqlDataReader reader1 = cmd1.ExecuteReader();
while (reader1.Read())
{
TextBox1.Text = reader1["title"].ToString();
TextBox2.Text = reader1["diary_time"].ToString();
RadioButtonList1.SelectedValue = reader2["heart"].ToString();
Response.Write(reader2["heart"].ToString());
}
reader1.Close();
} catch (Exception ex)
{
Response.Write(ex.Message);
} finally
{
conn1.Close();
}
}
解决方案 »
- visible=“false”不起效果
- 如何让一个自定义控件超链接。。。
- 数据类型 文本类型长度如何设置?
- dataset的作用是不可以理解为java中的hibernate?
- 关于发帖时的工具栏
- MVC Ajax 跳转问题
- 使用Web TreeView时展开几个节点后IE6.0浏览器出现错误
- 大公司是怎么做系统架构的?请有做过大公司的系统架构高手交流交流一下。
- 用vs7.net作aspx页时。需要调用多个aspx页。。。总是提示:分析器错误信息: 只能有一个“page”指令。
- 关于连接数据库和DataGrid控件行列的问题!(40分,答对就给)
- 我个人认为utf-16是不是表示所有字符的,你们认为呢?
- 后台获取 select 控件的option的值 =================
·详情请访问:http://www.515dns.com