I use OraDirect 4.75 for my asp.net application,when i run it in my develop machine,i use direct mode ok,but when i deploy my app to the server,i got the error below in the code:
{
OracleConnection connection = new OracleConnection(connectString);
}
NullReferenceException: object reference not set to an instance of an object]
CoreLab.Common.DbConnectionBase.get_ConnectionString() +11
CoreLab.Oracle.OracleConnection..ctor(String connectionString) +32
Login.ASPxButtonLogin_Click(Object sender, EventArgs e) in d:\CRM\Login.aspx.cs:18
DevExpress.Web.ASPxEditors.ASPxButton.OnClick(EventArgs e) +98
DevExpress.Web.ASPxEditors.ASPxButton.RaisePostBackEvent(String eventArgument) +402
DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
the server no oracle client installed,but my develop machine has,
the oracle server version is 8.17
my connectionstring is
user id=zccrm;password=ythcrm;server=192.168.1.200;unicode=True;direct=True;sid=PROD
Direct Mode for asp.net
I have do another test,when i use OracleDataSource in my asp.net page in Direct Mode,it can work well,
But when i Use the Code like this:
OracleConnection connection = new OracleConnection(connectString);
i got the error like above,why?
the only difference between these two method is the OracleDataSource has property
But when i Use the Code like this:
OracleConnection connection = new OracleConnection(connectString);
i got the error like above,why?
the only difference between these two method is the OracleDataSource has property
just bofore i have another test,
i write code like this:
protected CoreLab.Oracle.OracleConnection connection;
protected CoreLab.Oracle.OracleCommand cmd;
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.connection = new CoreLab.Oracle.OracleConnection();
this.cmd = new CoreLab.Oracle.OracleCommand();
}
protected void ASPxButtonLogin_Click(object sender, EventArgs e)
{
connection.ConnectionString = connectString;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "zccrm.pkg_user_manager.f_user_login";
cmd.Connection = connection;
.....
}
i got it, why?
i write code like this:
protected CoreLab.Oracle.OracleConnection connection;
protected CoreLab.Oracle.OracleCommand cmd;
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.connection = new CoreLab.Oracle.OracleConnection();
this.cmd = new CoreLab.Oracle.OracleCommand();
}
protected void ASPxButtonLogin_Click(object sender, EventArgs e)
{
connection.ConnectionString = connectString;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "zccrm.pkg_user_manager.f_user_login";
cmd.Connection = connection;
.....
}
i got it, why?