»áÔ±£º ÃÜÂ룺 ¡¡Ãâ·Ñ×¢²á | Íü¼ÇÃÜÂë | »áÔ±µÇ¼ ÍøÒ³¹¦ÄÜ£º ¼ÓÈëÊÕ²Ø ÉèΪÊ×Ò³ ÍøÕ¾ËÑË÷  
¼¼ÊõÎĵµ > Web¿ª·¢ > ASP.Net
Ç×ÃܽӴ¥ASP.Net(8)
·¢±íÈÕÆÚ£º2003-06-26 00:00:00×÷Õߣº· ³ö´¦£º  

ÎÒÃÇÇ°ÃæµÄÕ½ڽ²ÁËÒ»ÏÂÈçºÎÏÔʾÊý¾Ý¿âÖÐÐÅÏ¢ÒÔ¼°DataReaderºÍDataSetµÄ»ù±¾Ó÷¨£¬ÓÐÅóÓÑ˵²»¹ýñ«£¬ÒªÎÒ¿ì¿ìдÏÂÃæµÄÕ½ڣ¬ºÜÊǶԲ»Æð£¬ÎÒʵÔÚÊÇûÓÐÌ«¶àʱ¼ä£¬Ð´ÕâЩºÜÂý¡££¨²»ÒªÈÓ¼¦µ°£¬×î¶àÎÒ²»Ëµ·Ï»°À²)

ÎÒÃÇÕâÀﻹÊÇÀ´½²½²DataSet°É£¬ÕâÊÇÒ»¸ö¹¦ÄÜÇ¿´óµÄ¶«¶«£¬ÎÒÃÇÔÚÉÏÒ»½Ú¶ÔËüÓÐÁËÒ»¸ö³õ²½µÄÁ˽⣬ÕâÀïÎÒÃÇÒª½²ÆäÈç¹ûÓÃÀ´²Ù×÷Êý¾Ý¡£Ò²ÊǺܼòµ¥µÄ¶«¶«£¬µ«Êǹ¦ÄÜÇ¿´ó,Òª½²È«£¬²»Ì«¿ÉÄÜ£¬ÒòΪDataSetºÍDataGrid¿Ø¼þµÄ½²½â¾ÍÕ¼ÁË.Net °ïÖúµÄ50%ÒÔÉÏ£¬¶øÕâ¸ö×ܹ²ÓÐ23M...

ÕâÀïÎÒÃǽ¨Á¢Ò»¸ötest.mdbÊý¾Ý¿â£¬×öΪ²âÊÔµÄÊý¾Ý¿â£¬ÆäÖÐÓÐÒ»¸öÃûΪaspcnµÄ±í£¬Êý¾Ý½á¹¹Èçͼ

field name data type

username   text

address   text

school    text

²»ÐèDataSetµÄÊý¿â²Ù×÷

ÔÚ½²DataSetµÄÓ¦ÓÃ֮ǰ£¬ÎÒÃÇÀ´¿´¿´ÔÚASP.net²»Ê¹ÓÃDataSetÈçºÎ¶ÔÊý¾Ý¿â½øÐвåÈ룬¸üУ¬É¾³ý.

Òª¶ÔÊý¾Ý½øÐвåÈ룬¸üУ¬É¾³ý¶øÓÖ²»ÄÜÓÃDataSet£¬Ã»Óа취£¬Ö»ÓÐÓÃSQLÖ±½ÓÀ´À²£º)£¬ÎÒÕâÀïÖ»½²Ò»ÏÂÔõÑùÈ¥²åÈ룬ÒòΪÆäËüµÄ²Ù×÷Ö»ÊǸÄÒ»ÏÂSQLÓï¾ä£¬ÎÒÏë´ó¼ÒûÓÐÎÊÌâ°É¡£ÕâÀïÓÉÓÚʹÓõÄÊÇmdbÊý¾Ý¿â£¬ÄÇôÕâ´Î¾ÍÒªÓÃADO.netÀ´²Ù×÷ÁË¡£

ÎÒÃÇÏÈ¿´¿´Õû¸öÔ´´úÂëÔÙ˵

<% @ Page Language="C#" %>

<% @ Import Namespace="System.Data" %>

<% @ Import Namespace="System.Data.ADO" %>

<Script Language="C#" Runat="Server">

public string myConnstring="Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:/test/test.mdb;";

ADOConnection MyConnection;

public void Page_Load(Object src,EventArgs e)

{

//Óû§Ìá½»Êý¾Ý

}

public void submit_Click(Object src,EventArgs e)

{

string username1 = Request.Form["username"];

string address1 = Request.Form["address"];

string school1 = Request.Form["shool"];

string strInsert="insert into aspcn(username,address,school)

values('"+username1+"','"+address1+"','"+school1+"')";

//¿ªÊ¼Áª½á

try

{

MyConnection = new ADOConnection(myConnstring);

ADOCommand MyCommand = new ADOCommand(strInsert,MyConnection);

MyConnection.Open();

MyCommand.ExecuteNonQuery();

MyConnection.Close();

Info.Text="Êý¾ÝÒѾ­±£´æ";

}

catch(Exception ee)

{

Info.Text="·¢Éú´íÎó:"+ee.Message;

}

}

</script>

<html>

<head>

<title></title>

</head>

¡¾·µ»Ø¶¥²¿¡¿ ¡¾´òÓ¡±¾Ò³¡¿ ¡¾¹Ø±Õ´°¿Ú¡¿

¹ØÓÚÎÒÃÇ / ¸øÎÒÁôÑÔ / °æȨ¾Ù±¨ / Òâ¼û½¨Òé / ÍøÕ¾±à³ÌQQȺ   
Copyright ©2003- 2024 Lihuasoft.net webmaster(at)lihuasoft.net ¼ÓÔØʱ¼ä 0.00403