您现在的位置是:首页 >

如何知道asp已经连接数据库 ASP.NET 链接数据库基础教程

火烧 2021-09-15 04:06:14 1059
ASP.NET 链接数据库基础教程   i dex a x     lt %@ Page La guage= C# % gt    lt %@ im ort Name ace= Sy tem Data
如何知道asp已经连接数据库 ASP.NET 链接数据库基础教程

ASP.NET 链接数据库基础教程  

  index aspx    <%@ Page Language= C# %>  <%@ import Namespace= System Data %>  <%@ import Namespace= System Data OleDb %>  <script runat= server >    // Insert page code here  //  void Page_Load(){  string db=@ database/data mdb ;  string connStr= PROVIDER=Microsoft Jet OLEDB ;DATA Source= +Server MapPath(db)+ ; ;    string SQLcmd= create table IEB_webs(ID identity primary key title varchar( ) Default Null) ;    OleDbConnection conn=new OleDbConnection(connStr);  conn Open();  OleDbCommand OleCmd=new OleDbCommand(SQLcmd conn);    OleCmd ExecuteNonQuery();   //执行SQL命令    Response Write( 数据表建立完成! );  }    conn Close();  conn=null;  OleCmd=null;    }    </script>  <>  <head>  </head>  <body>  <form method= post runat= server >  <! Insert content here >  </form>  </body>  </> lishixinzhi/Article/program/net/201311/12081  
永远跟党走
  • 如果你觉得本站很棒,可以通过扫码支付打赏哦!

    • 微信收款码
    • 支付宝收款码