`
glacier3
  • 浏览: 376978 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

2007-04-29

阅读更多

今天和昨天学习的内容:

1.SQL2005数据库的连接:

c# 代码
  1. using System.Data.SqlClient;   
  2.  String sql = "select id,title,time from news order by id desc";   
  3.  private SqlConnection con=con = new SqlConnection("server=192.168.1.118\\sqlexpress;database=news;uid=sa;pwd='kings'");   
  4.  con.Open();   
  5. DataSet ds = new DataSet();   
  6.         SqlDataAdapter cmd = new SqlDataAdapter(sql, con);   
  7.         cmd.Fill(ds, "news");   
  8.         DataGrid1.DataSource = ds.Tables["news"].DefaultView;   
  9.         DataGrid1.DataBind();   

 

c# 代码
  1. con.Open();   
  2.        String sql = "delete from news where id=" +(c_id.Text.Trim());   
  3.       cmd = new SqlCommand(sql,con);   
  4.       cmd.ExecuteNonQuery();  
c# 代码
  1. SqlCommand cmd = new SqlCommand("select * from yanzheng", conn);   
  2.   SqlDataReader myReader=null;   
  3. conn.Open();   
  4.             try  
  5.             {         
  6.                 myReader = cmd.ExecuteReader();   
  7.                 while (myReader.Read())   
  8.                 {   
  9.                 name=(String)myReader["name"];   
  10.                 password=(String)myReader["password"];   
  11.                 }   
  12.   
  13.   
  14.         }   
  15.             catch (Exception ex) {   
  16.   
  17.                 Response.Write(ex.ToString());   
  18.             }   
  19.             finally {    
  20.   
  21.             if(myReader!=null)   
  22.                 myReader.Close();   
  23.             if (conn.State == ConnectionState.Open)   
  24.                 conn.Close();   
  25.             }   
  26.    
c# 代码
  1.      
  2.          Width="500px"  
  3.          PagerStyle-HorizontalAlign="left"  
  4.           PagerStyle-Mode="NumericPages"  
  5.            OnPageIndexChanged="ChangePage"  
  6.             HeaderStyle-BackColor="#AAAADD"  
  7.              AlternatingItemStyle-BackColor="#ffffcd"  
  8.               BorderColor="Black"  
  9.                CellPadding="0"  
  10.                 CellSpacing="0"  
  11.                   AutoGenerateColumns="false"  
  12.                    PageSize="20" AllowPaging="True"        
  13.            
  14.     >   
  15.     <columns></columns>   
  16.                  
  17.           "Left" />   
  18.       
  19.     
  20.            
  21.             "AntiqueWhite" />   
  22.             "Left" Mode="NumericPages" />   
  23.             "#FFFFCD" />   
  24.     

 

2.DataAdapter对象和DataSet对象:

DataAdapter对象用于获取数据,填充DATASET中的表和约束将对DATASET的更改提交回数据员.

分享到:
评论

相关推荐

    最全IIS6.0安装包

    2007-02-17 06:43 29,184 iispwchg.dll 2007-02-17 06:44 349,696 w3core.dll 2005-04-04 00:00 83,754 w3core.mfl 2005-04-04 00:00 74,002 w3core.mof 2007-02-17 06:44 39,424 w3dt.dll 2007-02-17 06:50 4,862 ...

    汇编语言入门教程2007

    汇编语言入门教程2007-04-29 22:04对初学者而言,汇编的许多命令太复杂,往往学习很长时间也写不出一个漂漂亮亮的程序,以致妨碍了我们学习汇编的兴趣,不少人就此放弃。所以我个人看法学汇编,不一定要写程序,写...

    XP系统IIS用dll文件

    2007-05-04 12:29 145,408 iische51.dll 2007-05-04 12:39 79,872 iislog51.dll 2011-01-18 22:11 15,360 inetin51.exe 2004-01-26 01:27 77,824 metada51.dll 2007-10-18 23:44 46,592 svcext51.dll 2011-01-18 22:...

    一套简单实用的会员系统

    Create: 2007-04-29 Version: 1.0 Language: VBscript &lt;!--#include file="Inc/conn.inc"--&gt; &lt;!--#include file="Inc/checkUserName.inc"--&gt; &lt;!--#include file="Inc/saveNRegUser.inc"--&gt; userName = request...

    hibernate各个版本下载地址

    3.3.0.cr1 2008-04-29 3.2.6.ga 2008-02-07 3.2.5.ga 2007-07-31 3.2.4.sp1 2007-05-18 3.2.4.ga 2007-05-09 3.2.3.ga 2007-04-02 3.2.2.ga 2007-01-24 3.2.1.ga 2006-11-17 3.2.0.ga 2006-10-16 3.2.0.cr5...

    装机人员工具 OEM-DIY品牌自己做5.1

    2007-04-16 00:44 810,873 OEM-DIY品牌自己做5.1.exe 2008-02-08 15:57 326,656 TCPIP并发连接数修改.exe 2007-10-18 19:33 120,832 U盘病毒免疫器.exe 2008-03-05 03:07 &lt;DIR&gt; XP序列号替换器 2008-05-29 11:49 1,...

    最新aodv源码

    2004-10-29 04:21 1,705 aodv_hello.h 2004-10-29 04:21 5,898 aodv_neighbor.c 2004-10-29 04:21 1,385 aodv_neighbor.h 2004-10-29 04:21 6,178 aodv_rerr.c 2006-02-01 04:28 2,416 aodv_rerr.h 2004-10-29 04:21...

    在线聊天站源程序.rar

    2007-03-29 1、增加html获取get变量,并设置初始reciveUser, 以弹出窗口形式打开不同客服的客户端; 2、新增上述客户端代码的测试页面,并支持 点击按钮往左缩进屏幕,再次点击恢复原来位置; 2007-03-31 1...

    dwl-g122 b1 c1

    Date: 2008/04/29 Fix: 12. Change G122.C1 utility version to 3.30(E) ------------------------------------------------------------------------------------------- Setup Version: S0038 Build: 62224 ...

    西班牙远程控制Coolvibes以及madCollection控件

    2010-04-09 20:18 331 247 Coolvibes\Client\Configuracion.ini 2009-08-17 22:40 1264 514 Coolvibes\Client\Coolvibes.dpr 2008-11-18 16:44 5120 1395 Coolvibes\Client\Coolvibes.res 2010-05-03 21:14 106 78 ...

    Notepad++32位插件打包备份(30个)

    2007-10-20 20:22 17,428 HTMLTag-entities.ini 2017-10-06 14:02 278,016 JSMinNPP.dll 2017-08-29 08:43 98,992 mimeTools.dll 2010-06-04 16:02 282,624 MultiClipboard.dll 2010-06-04 16:02 50,176 ...

    CSerialPort串口类最新修正版2016-06-29

    Second Version by mrlong on 2007-12-25 https://code.google.com/p/mycom/ 增加 ClosePort 增加 WriteToPort 两个方法 增加 SendData 与 RecvData 方法 by liquanhai on 2011-11-04 ...

    微软工具包 微软工具包

    2007-04-27 10:17 87,424 streams.exe 2009-02-27 17:22 136,592 strings.exe 2006-11-01 14:05 150,328 sync.exe 2009-03-16 12:16 150,888 tcpvcon.exe 2006-10-30 10:32 40,016 tcpview.chm 2009-03-16 12:16 198...

    php+mysql新闻发布系统

    (29, '10', 'Å£Îľü', '2008-04-17', '´ó¼ÒºÃ°¡'), (30, '3', '³þÏس¤', '2008-04-17', 'ͬ־ÃÇÐÁ¿àÁË£¡'), (32, '1', '123', '2008-04-17', '123'), (33, '4', '123', '2008-04-...

    DELPHI皮肤控件BusinessSkinForm以及137套精美皮肤

    2004-02-04 22:04 2512 281 BusinessSkinForm\Animate3\mainmenuitems.bmp 2003-11-01 23:43 3602 92 BusinessSkinForm\Animate3\mdibg.bmp 2004-02-04 22:05 4208 483 BusinessSkinForm\Animate3\menuitems.bmp ...

    上市公司贷款数据库上市公司贷款数据库

    29 至 2022-04-25) 二. 向银行贷款信息 1. 上市公司向银行借款 表(日)(2000-01-11 至 2022-04-25) 2. 上市公司银行贷 款担保情况表(日)(1998-01-17 至 2022-04-25) 3. 上市 公司向银行借款统计表(半年)...

    Ajiu AspWebServer V2.0 服务器 (版本号2.0.2.4)

    2007-4-29 默认端口有两个,当你启用了IIS的时候,它会自动调用8081端口,聪明了一点...(已上传) 2007-5-25 新增自定义目录浏览,新增ftp服务器 2007-6-1 完善Ftp服务器功能 2007-6-15 新增完全自定义默认主页,完全...

    FreeZ_MadCollection.v2.5.7.0_FS

    2005-04-29 18:01 8243 72 madExcept\Demos\EC.bdsproj 2004-10-03 11:00 8246 80 madCodeHook\Demos\system wide\VariousDlls\Empty.bdsproj 2004-10-03 10:36 8249 77 madExcept\Demos\ExcCatch.bdsproj 2004-10-...

    CSerialPort串口类最新修正版2016-08-02

    Second Version by mrlong on 2007-12-25 https://code.google.com/p/mycom/ 增加 ClosePort 增加 WriteToPort 两个方法 增加 SendData 与 RecvData 方法 by liquanhai on 2011-11-04 ...

Global site tag (gtag.js) - Google Analytics