posts - 21,  comments - 1,  trackbacks - 0
数据库连接字符串:
    <connectionStrings>
  
<add name="AdventureWorksDWConnectionString" connectionString="Data Source=QQ123\SQL2005;Initial Catalog=AdventureWorksDW;Persist Security Info=True;User ID=sa;Password=7894561230."
   providerName
="System.Data.SqlClient" />
 
</connectionStrings>
在C#语句的连接方式语句:
    protected void Page_Load(object sender, EventArgs e)
    
{
        
if (!IsPostBack)
        
{
            
string con = ConfigurationManager.ConnectionStrings["AdventureWorksDWConnectionString"].ConnectionString;
            Label2.Text 
= con;

            SqlConnection conn 
= new SqlConnection(con);

            SqlDataAdapter asd 
= new SqlDataAdapter();
            asd.SelectCommand 
= new SqlCommand("select * from DatabaseLog", conn);
            DataSet ds 
= new DataSet();
            asd.Fill(ds, 
"emp");


            
this.GridView1.DataSource = ds.Tables["emp"];
            
this.GridView1.DataBind();
         

        }

}
posted on 2008-05-20 23:15 默默無語中 阅读(24) 评论(0)  编辑 收藏

标题  
姓名  
主页
Email (只有博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
 
 


<2008年5月>
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

21世纪一个人的成功不完全是你的才华 关键是你能够统占整合多少资源 然后达成一个预计的目标

 
点击这里给我发消息 
无限次升级的江民杀毒软件

与我联系

搜索

 

常用链接

留言簿

随笔档案(21)

文章档案(3)

相册

收藏夹(13)

一个收藏经典的站

最新随笔

最新评论

评论排行榜