Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Asp.netÁ¬½ÓÊý¾Ý¿â½Ì³Ì£¨vb.net£©

Asp.netÁ¬½ÓSQL Server2000Êý¾Ý¿âÀý³ÌÏê½â: 
<%@ Import Namespace="System.Data" %> 
<%@ Import NameSpace="System.Data.SqlClient" %> 
<script laguage="VB" runat="server"> 
sub page_load(sender as Object,e as EventArgs) 
Dim myConnection As SqlConnection 
Dim myCommand As SqlCommand 
Dim ds as DataSet 
'1.connect to sql server 
myConnection = New SqlConnection( "server=localhost;database=Pubs;uid=ueytjdf;pwd=doekdf" ) 
myConnection.Open() 
la1.text="Connection Opened!" 
'2.Create a table 
myCommand = New SqlCommand( "CREATE TABLE [test] ([id] [int] IDENTITY (1, 1) NOT NULL ,[name] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,[sex] [char] (10) COLLATE Chinese_PRC_CI_AS NULL )", myConnection ) 
myCommand.ExecuteNonQuery() 
la2.text="New table created!" 
'2 Ìí¼Ó¼Í¼ 
myCommand = New SqlCommand( "Insert into [test] (name,sex) values( '»ÆÖ¾ÎÄ','ÄÐ' )", myConnection ) 
myCommand.ExecuteNonQuery() 
la3.text="New Record Inserted!" 
'3 ¸üÐÂÊý¾Ý 
myCommand = New SqlCommand( "UPDATE [test] SET name='Smith' where name='ÀîÃ÷'", myConnection ) 
myCommand.ExecuteNonQuery() 
la4.text="Record Updated!" 
'4 É¾³ýÊý¾Ý 
myCommand = New SqlCommand( "delete from [test] where name='Smith'", myConnection ) 
myCommand.ExecuteNonQuery() 
la5.text="Record Deleted!" 
'5 ÓÃDataGridÏÔʾÊý¾Ý 
myComma


Ïà¹ØÎĵµ£º

Asp.Net ButtonµÄUseSubmitBehaviorÊôÐÔ

ÔÚijҳÃæÉÏÓÐÈçÏÂÐÅÏ¢£¬
Html£¬
<asp:Button ID="btn" runat="server" Text="Click me" OnClick="ButtonClicked" />
<script language="javascript">
function javascriptMethod() {
alert(1);
}

</script>
C#£¬
protected void ButtonClic ......

ÓÃasp.net»¹Ô­Óë»Ö¸´sqlserverÊý¾Ý¿â

  
ÉÏ´Î×öÁ˸öÏîÄ¿£¬Éæ¼°µ½Êý¾Ý¿âµÄ»¹Ô­ºÍ»Ö¸´£¬µ½ÍøÉÏÕÒÁËһϣ¬ÊÇÀûÓÃSQLDMOʵÏֵģ¬Ö»ÒªÌí¼ÓSQLDMOÒýÓþͺÃÁË£¬È»ºóÀûÓÃϱߵÄÀàµÄ·½·¨¾Í¿ÉÒÔʵÏÖÁË¡£
ÎÒ°ÑÔ­×÷ÕßµÄÀàÀ©³äÁËһϣ¬¿ÉÒÔ×Ô¶¯Ê¶±ðweb.configÀï µÄÊý¾Ý¿âÁ¬½Ó×Ö·û´®£¬¿ÉÒÔͨ¹ý±äÁ¿ÉèÖû¹Ô­»Ö¸´µÄÐÅÏ¢¡£
ÐèҪעÒâµÄʱ»¹Ô­£¬»¹Ô­µÄʱºòÎÊÌ ......

asp.net ·¢ËÍÓʼþ

web.config:
    <system.net>
        <mailSettings>
            <smtp deliveryMethod="Network" from="chunyou128&lt;you@163.com&gt;">
     &n ......

ÔÚASP.NETÖзÃÎÊDataGridÖÐËùÓпؼþµÄÖµ

<%@ Page Language="C#" %>
<%@ import Namespace="System.Collections" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e) {
if(!Page.IsPostBack){
ArrayList data = new ArrayList();
data.Add(new Person("Tom",33,true));
data.Add(new Person("Jhon",39,false));
da ......

asp.net½áºÏaspnetpagerÓÃsqlÓï¾ä·ÖÒ³

Êý¾Ý¿â²Ù×÷Àࣺ
¸´ÖÆ´úÂë ´úÂëÈçÏÂ:
/// <summary>
/// È¡µÃ×ÜÊý
/// </summary>
/// <returns></returns>
public string getTotal()
{
StringBuilder sb = new StringBuilder();
sb.Append("select count(*) total from Test");
DataTable dt = DBHelper.ExecuteDt(sb.ToString ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ