Wednesday, 14 March 2012

Simple web application for System.Data.OracleClient

using System.Data;using System.Data.OracleClient;namespace
{
OracleWebConnectivitypublic partial class _Default : System.Web.UI.Page{

{


cmd.CommandType =

protected void Page_Load(object sender, EventArgs e)OracleConnection conn = new OracleConnection("user id=xyz;password=****;data source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = serverName)(PORT = portAdds))(CONNECT_DATA = (SID = hoststring)))");OracleCommand cmd = new OracleCommand("Select empname from emp1", conn);CommandType.Text;//cmd.Parameters.AddWithValue("empname",empname);//cmd.Parameters.AddWithValue("empno",empno);conn.Open();
cmd.ExecuteNonQuery();


da.Fill(dt);

OracleDataAdapter da = new OracleDataAdapter(cmd);DataTable dt = new DataTable();foreach (DataRow row in dt.Rows)//Console.WriteLine(row["empname"] + "; " + row["empno"]); // this row for Console applicationlbl1.Text =

conn.Close();

}
}
}
" "+row["empname"];

No comments:

Post a Comment