我思故我在

时刻关注信息技术

李立宗ID:superdont
84268次访问,排名1112好友1人,关注者7
努力工作中。。。。。。
superdont的文章
原创 169 篇
翻译 0 篇
转载 43 篇
评论 29 篇
李立宗的公告
李立宗,2008年6月毕业于南开大学软件学院计算机软件与理论专业,就职于天津工程师范学院,欢迎就技术问题进行交流,lilizong[at]gmail.com



最近评论
cqg1220:机柜
cqg1220:机柜
fly_to_the_winds:你这也叫原创啊?太肤浅了点吧?选中行取值还不分事件?
为什么 (378209553@QQ.com):imshow('C:\Documents and Settings\系统维护\桌面\a.jpg');title('原图像')
I=imread('C:\Documents and Settings\系统维护\桌面\a.jpg');
figure;imhist(I),title('对应直方图')
%从得到的直方图可以看出,图像的对比度很低,灰度级集中在70-160……
anan:我就喜欢这个啊  实用.
文章分类
收藏
    相册
    技术
    张效祥专栏
    深之JohnChen的专栏
    美容美发吧
    计算机培训
    语义web
    未分类
    bilei
    My tutor
    pp设计
    songthin
    一缕绸丝半叶茶
    冰冰的墙
    北邮hope课堂
    半梦半醒
    博客玩默默
    天津美发网
    小狗之家
    小白的流水帐
    才子
    李平
    生活就是映像
    贺正冰
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 ado.net的连接显示实例收藏

    新一篇: DetailsView不能更新数据库的问题 | 旧一篇: ado.net数据库连接


    从昨天晚上开始调试,终于调试成功,下面是代码。


    web.config中的部分。
    <configuration>
        <add name="sqlconn"
       connectionString="server=LILIZONG;database=dangwei;uid=sa;" providerName="System.Data.SqlClient"/>
     </connectionStrings>

    显示页的cs部分。

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    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 test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack){TestCommandReader();}
        }


        private void TestCommandReader()
        {
            String myConnectionString=ConfigurationManager.ConnectionStrings["sqlconn"].ConnectionString;
            SqlConnection myConn=new SqlConnection(myConnectionString);
            //SqlConnection myConn=new SqlConnection(myConnectionString);
            String cmdText="select * from geren";
            SqlCommand myCommand=new SqlCommand(cmdText,myConn);
           
            try
            {
                myConn.Open();
                SqlDataReader mydr=myCommand.ExecuteReader();
                while(mydr.Read())
                {
                    Userlist.Items.Add(new ListItem((String)mydr["name"]));}
                  
                mydr.Close();
                SqlDataReader mydrOther=myCommand.ExecuteReader();
                //UserOtherList.DateSource=mydrOther;
                UserOtherList.DataSource = mydrOther;

                //UserOtherList.datatextfield="name";
                //UserOtherList.datavaluefield = "birthday";
               //UserOtherList.databind();
                //mydrOther.close();
                UserOtherList.DataTextField = "name";
                UserOtherList.DataValueField = "birthday";
                UserOtherList.DataBind();
                mydrOther.Close();
            }
            catch(SqlException sqlex)
            {
                Response.Write(sqlex.Message+"<br>");
            }
            finally{
                myConn.Close();
            }
        }
        protected void Userlist_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }


    显示页aspx部分:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ListBox ID="Userlist" runat="server" Height="400px" Width="300px">
        </asp:ListBox>
        <asp:ListBox ID="UserOtherList" runat="server" Height="400px" Width="300px" ></asp:ListBox>
        </form>
    </body>
    </html>



     

    发表于 @ 2007年01月31日 09:08:00|评论(loading...)|编辑

    新一篇: DetailsView不能更新数据库的问题 | 旧一篇: ado.net数据库连接

    评论:没有评论。

    发表评论  


    登录
    Csdn Blog version 3.1a
    Copyright © 李立宗