|
|
|
Namespace (System.Data.OracleClient) ของ asp.net 4.0 Visual studio 2010 ใช้ไม่ได้ต้องเปิดอารายเพิ่มหรือเปล่า คับ |
|
|
|
|
|
|
|
Code (C#)
OleDbConnection cn = new OleDbConnection();
OleDbCommand cm = new OleDbCommand();
OleDbDataAdapter da = new OleDbDataAdapter();
DataTable dt = new DataTable();
DataSet ds = new DataSet();
StringBuilder sb = new StringBuilder();
string sql = "";
protected void Page_Load(object sender, EventArgs e)
{
if (cn.State == System.Data.ConnectionState.Open) cn.Close();
cn.ConnectionString = "Provider=MSDAORA;Data Source=XXXX;Password=XXXX;User ID=XXX;";
cn.Open();
sb.Remove(0, sb.Length);
sb.Append("select * from customer ");
sb.Append(" where customerid = '000005'");
sql = sb.ToString();
da = new OleDbDataAdapter(sql, cn);
if (ds.Tables["aa"] != null)
{
ds.Tables["aa"].Clear();
}
da.Fill(ds, "aa");
dt = ds.Tables["aa"];
if (dt.Rows.Count != 0)
{
DetailsView1.DataSource = dt;
DetailsView1.DataBind();
}
}
|
|
|
|
|
Date :
2011-09-16 16:07:37 |
By :
lee_latee |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|