国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

ado.net數(shù)據(jù)操作全接觸一(insert,update,delete)

2024-07-10 13:02:47
字體:
供稿:網(wǎng)友
1.1創(chuàng)建數(shù)據(jù)庫連接(sqlserver)
1: <%@ import namespace="system.data" %>
2: <%@ import namespace="system.data.sqlclient" %>
3: <%
4: dim myconnection as sqlconnection
5: myconnection = new sqlconnection( "server=localhost;database=pubs;uid=sa" )
6:
7: myconnection.open()
8: %>
9: connection opened!
1.2創(chuàng)建數(shù)據(jù)庫連接(access)
1: <%@ import namespace="system.data" %>
2: <%@ import namespace="system.data.oledb" %>
3: <%
4: dim myconnection as oledbconnection
5: myconnection = new oledbconnection( "provider=microsoft.jet.oledb.4.0;data
http://aspfree.com/chapters/sams/graphics/ccc.gifsource=c:/authors.mdb" )
6:
7: myconnection.open()
8: %>
9: connection opened!
2.1添加紀(jì)錄(sqlserver)
 1: <%@ import namespace="system.data" %> 
2: <%@ import namespace="system.data.sqlclient" %> 
3: 
4: <% 
5: dim myconnection as sqlconnection 
6: dim mycommand as sqlcommand 
7: 
8: myconnection = new sqlconnection( "server=localhost;uid=sa;database=pubs" ) 
9: myconnection.open()
10: mycommand = new sqlcommand( "insert testtable ( col1 ) http://aspfree.com/chapters/sams/graphics/ccc.gifvalues ( 'hello' )", myconnection )
11: mycommand.executenonquery()
12: myconnection.close()
13: %>
14: new record inserted!
15:
2.2添加紀(jì)錄(access)
1: <%@ import namespace="system.data" %> 
2: <%@ import namespace="system.data.oledb" %> 
3: 
4: <% 
5: dim myconnection as oledbconnection 
6: dim mycommand as oledbcommand 
7: 
8: myconnection = new oledbconnection( "provider=microsoft.jet.oledb.4.0;data http://aspfree.com/chapters/sams/graphics/ccc.gifsource=c:authors.mdb" ) 
9: myconnection.open()
10: mycommand = new oledbcommand( "insert into authors ( author ) values http://aspfree.com/chapters/sams/graphics/ccc.gif( 'simpson' )", myconnection )
11: mycommand.executenonquery()
12: myconnection.close()
13: %>
14: new record inserted!
15:
3.1更新數(shù)據(jù)(sqlserver)
1: <%@ import namespace="system.data" %> 
2: <%@ import namespace="system.data.sqlclient" %> 
3: 
4: <% 
5: dim myconnection as sqlconnection 
6: dim mycommand as sqlcommand 
7: 
8: myconnection = new sqlconnection( "server=localhost;uid=sa;database=pubs" ) 
9: myconnection.open()
10: mycommand = new sqlcommand( "update authors set lastname='smith' http://aspfree.com/chapters/sams/graphics/ccc.gifwhere lastname='bennett'", myconnection )
11: mycommand.executenonquery()
12: myconnection.close()
13: %>
14: record updated!
15:
3.2更新數(shù)據(jù)(access)
1: <%@ import namespace="system.data" %>
 2: <%@ import namespace="system.data.oledb" %> 
3: 
4: <% 
5: dim myconnection as oledbconnection 
6: dim mycommand as oledbcommand 
7: 
8: myconnection = new oledbconnection( "provider=microsoft.jet.oledb.4.0;data http://aspfree.com/chapters/sams/graphics/ccc.gifsource=c:/authors.mdb" ) 
9: myconnection.open()
10: mycommand = new oledbcommand( "update authors set author='bennett' http://aspfree.com/chapters/sams/graphics/ccc.gifwhere author = 'simpson'", myconnection )
11: mycommand.executenonquery()
12: myconnection.close
13: %>
14: record updated!15:
3.3更新數(shù)據(jù)中受影響的記錄數(shù)
1: <%@ import namespace="system.data" %> 
2: <%@ import namespace="system.data.sqlclient" %> 
3: 
4: <% 
5: dim myconnection as sqlconnection 
6: dim mycommand as sqlcommand 
7: dim recordsaffected as integer
8:
9: myconnection = new sqlconnection( "server=localhost;uid=sa;database=pubs" )
10: myconnection.open()
11: mycommand = new sqlcommand( "update testtable set col1='hello' http://aspfree.com/chapters/sams/graphics/ccc.gifwhere col1='fred'", myconnection )
12: recordsaffected = mycommand.executenonquery()
13: response.write( "the update statement modified " & http://aspfree.com/chapters/sams/graphics/ccc.gifrecordsaffected.tostring() & " records!" )
14: myconnection.close
15: %>
16:
4.1刪除數(shù)據(jù)(sqlserver)
1: <%@ import namespace="system.data" %>
2: <%@ import namespace="system.data.sqlclient" %>
3:
4: <%
5: dim myconnection as sqlconnection
6: dim mycommand as sqlcommand
7:
8: myconnection = new sqlconnection( "server=localhost;uid=sa;database=pubs" )
9: myconnection.open()
10: mycommand = new sqlcommand( "delete testtable where col1='fred'", myconnection )
11: mycommand.executenonquery()
12: myconnection.close()
13: %>
14: record deleted!
15:
4.2刪除數(shù)據(jù)(access)
 1: <%@ import namespace="system.data" %> 
2: <%@ import namespace="system.data.oledb" %>
3:
4: <%
5: dim myconnection as oledbconnection
6: dim mycommand as oledbcommand
7:
8: myconnection = new oledbconnection( "provider=microsoft.jet.oledb.4.0;data http://aspfree.com/chapters/sams/graphics/ccc.gifsource=c:/authors.mdb" )
9: myconnection.open()
10: mycommand = new oledbcommand( "delete from authors http://aspfree.com/chapters/sams/graphics/ccc.gifwhere author = 'simpson'", myconnection )
11: mycommand.executenonquery()
12: myconnection.close()
13: %>
14: record deleted!
15:
16:
4.3刪除紀(jì)錄中受影響的記錄數(shù)
1: <%@ import namespace="system.data" %> 
2: <%@ import namespace="system.data.sqlclient" %>
3: 
4: <% 
5: dim myconnection as sqlconnection 
6: dim mycommand as sqlcommand 
7: dim recordsaffected as integer 
8: 
9: myconnection = new sqlconnection( "server=localhost;uid=sa;database=pubs" )
10: myconnection.open()
11: mycommand = new sqlcommand( "delete authors2 http://aspfree.com/chapters/sams/graphics/ccc.gifwhere lastname='smith'", myconnection )
12: recordsaffected = mycommand.executenonquery()
13: response.write( "the delete statement modified " http://aspfree.com/chapters/sams/graphics/ccc.gif& recordsaffected.tostring() & " records!" )
14: myconnection.close
15: %>
16:


收集最實用的網(wǎng)頁特效代碼!

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 海淀区| 绥芬河市| 广西| 黑山县| 鄂伦春自治旗| 宁夏| 夏津县| 措美县| 天祝| 铁力市| 东方市| 屯昌县| 京山县| 松阳县| 余姚市| 临沧市| 来安县| 岳普湖县| 双江| 济南市| 雷波县| 大名县| 饶河县| 华亭县| 双流县| 壶关县| 修文县| 乐安县| 连江县| 万宁市| 汉寿县| 渑池县| 双流县| 宜春市| 元氏县| 恩施市| 林周县| 深水埗区| 永川市| 达拉特旗| 南康市|