ASP.NET接続ACCESSデータベースの簡単な方法

1119 ワード

index.aspx
 
  



<br>    // Insert page code here <br>    // <br>    void Page_Load(){ <br>        string db=@"database/data.mdb"; <br>        string connStr="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source="+Server.MapPath(db)+";"; <br>        string SQLcmd="create table IEB_webs(ID identity primary key,title varchar(255) Default Null)"; <br>        OleDbConnection conn=new OleDbConnection(connStr); <br>        conn.Open(); <br>        OleDbCommand OleCmd=new OleDbCommand(SQLcmd,conn); <br>        OleCmd.ExecuteNonQuery();      // SQL <br>        Response.Write(" !"); <br>        } <br>        conn.Close(); <br>        conn=null; <br>        OleCmd=null; <br>    } <br>