Jump to content
Xtreme .Net Talk

ace333

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by ace333

  1. here is the code sample int i =0; while (myDataReader.Read()/*&&(i<120)*/) { CommentId = myDataReader["CommentId"].ToString(); Comments = myDataReader["Comments"].ToString().Replace("<","<"); Comments = Comments.Replace(">",">"); //Comments = Comments.Replace("&","&"); //Comments = Comments.Replace("�","€"); //Comments = Comments.Replace("\"","""); //Comments = Comments.Replace("'","'"); UserId = myDataReader["UserId"].ToString(); RiskId_ExternalId = myDataReader["RiskId\\ExternalId"].ToString(); i++; table=table+"<tr><td> "+myDataReader["CommentId"]+"</td><td> "+myDataReader["DacType"]+"</td><td> "+myDataReader["SheetId"]+"</td><td> "+Comments+"</td><td> "+myDataReader["TypeOfComment"]+"</td><td> "+RiskId_ExternalId+"</td><td> "+UserId+"</td><td> "+myDataReader["FullName"]+"</td><td> "+myDataReader["AmendedDateTime"]+"</td></tr>"; } table = "<html><head><title>Test</title></head><body><table border='1'>"+"<tr><td><b>CommentId</b></td><td><b> DacType</b></td><td><b>SheetId</b></td><td><b>Comments</b></td><td><b>TypeOfComment</b></td><td><b>RiskId\\ExternalId</b></td><td><b>UserId</b></td><td><b>FullName</b></td><td><b>AmendedDateTime</b></td></tr>"+table+"</table></body></html>"; TextWriter xmlContent = new StreamWriter(@"C:\Temp\xmlContent.txt"); I have written the output to a file before and after its sent through the email server and after it comes out ! are found between the <!/td> closing tags <html><head><title>Test</title></head><body><table border='1'><tr><td><b>CommentId</b></td><td><b> DacType</b></td><td><b>SheetId</b></td><td><b>Comments</b></td><td><b>TypeOfComment</b></td><td><b>RiskId\ExternalId</b></td><td><b>UserId</b></td><td><b>FullName</b></td><td><b>AmendedDateTime</b></td></tr><tr><td> 1</td><td> CAP</td><td> 107</td><td> As per L Dudley s request</td><td> RejectedComment</td><td> 78009685</td><td> lcross3</td><td> LISA CROSS</td><td> 18/08/2005 17:07:44</td></tr><tr><td> 1</td><td> CAP</td><td> 107</td><td> Payment attached to option. Option cpty changed to ISS/CRESGB2L from BOC. As payment is attached it s now showing in Payment tracker. Pls reverse. any questions plc call me. Thxs x37608</td><td> Comment</td><td> 78009685</td><td> lcross3</td><td> LISA CROSS</td><td> 18/08/2005 17:07:44</td></tr><tr><td> 1</td><td> CAP</td><td> 430</td><t! d> As per L Dudley ..... snippet of the code ..........
  2. MailMessage mail = new MailMessage(); mail.To = xxx@xxx.com; mail.From = xxx@xxx.com; mail.Subject = "xxx 10/10/2005"; mail.BodyFormat = MailFormat.Html; mail.Body ="large amount of html approximately 1080 rows of a table"; SmtpMail.SmtpServer = "xxx"; SmtpMail.Send(mail); Is there a limit to the amount of data that can be send using the c# mail methods... I am trying to send 1078 rows of data through but the html I get out from the email is slightly deformed, i.e. ! are inserted between some of the </!td> tags..... If I limit it to 140 rows or less things are fine...... Is there a max number of data that can be sent at a time..... Obviously I could send more that one email, but would prefer not to do that
  3. CREATE OR REPLACE PROCEDURE WES_UAT.P_INS_EMAIL ( param_sendTo IN EMAIL.SENDTO%TYPE, param_sendFrom IN EMAIL.SENDFROM%TYPE, param_subject IN EMAIL.SUBJECT%TYPE, param_format IN EMAIL.BODYFORMAT%TYPE, param_priority IN EMAIL.PRIORITY%TYPE, param_body IN EMAIL.EMAILBODY%TYPE, param_errorEmailAddress IN EMAIL.ERROREMAILADDRESS%TYPE, param_ccEmailAddress IN EMAIL.CCEMAILADDRESS%TYPE, param_systemName IN EMAIL.SYSTEMNAME%TYPE ) IS BEGIN INSERT INTO EMAIL( ID, SENDTO, SENDFROM, SUBJECT, EMAILBODY, BODYFORMAT, PRIORITY, LASTUPDATED, PROCESSEDFLAG, ERROREMAILADDRESS, CCEMAILADDRESS, SYSTEMNAME, INPUTDATE ) VALUES( SEQ_EMAIL_ID .NEXTVAL, param_sendTo, param_sendFrom, param_subject, param_body, param_format, param_priority, SYSDATE, 'N', param_errorEmailAddress, param_ccEmailAddress, param_systemName, SYSDATE ) returning id into GLOBALS.i ; END; This is an oracle stored proc How do I read the value i from the stored proc from c#, when i do the insert i want to be able to get the id associated with that insert
  4. ace333

    C# Smtp

    MailMessage mail = new MailMessage(); mail.To = xxx@xxx.com; mail.From = xxx@xxx.com; mail.Subject = "xxx 10/10/2005"; mail.BodyFormat = MailFormat.Html; mail.Body ="large amount of html approximately 1080 rows of a table"; SmtpMail.SmtpServer = "xxx"; SmtpMail.Send(mail); Is there a limit to the amount of data that can be send using the c# mail methods... I am trying to send 1078 rows of data through but the html I get out from the email is slightly deformed, i.e. ! are inserted between some of the </!td> tags..... If I limit it to 140 rows or less things are fine...... Is there a max number of data that can be sent at a time..... Obviously I could send more that one email, but would prefer not to do that
  5. i spotted that too ya to my absolute horror i noticed that as well, i spend a day staring at this problem,,,, i nearly threw the computer across the room in frustration
  6. System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Oracle.DataAccess.Client.OracleException ORA-01460: unimplemented or unreasonable conversion requested at Derivatives.Ops.WebService.EmailService.SendEmail(String XML) in The problem is that i'm sending a large amount of xml to an oracle database, one of the columns is a clob, but the issue of a 32k limit is causing me problems,,, I only need to input one row in the database as that row is used somewhere else later....., all the other columns are really small... its only one column that is big .... any suggestions please thanks
  7. The type or namespace name 'localhost' could not be found (are you missing a using directive or an assembly reference?) I have added a web reference from the local host but am still getting the above error localhost.EmailService test = new localhost.EmailService(); This is a project I have come back to and it worked before for the following net.xxx.app.ldnuat3.EmailService test = new net.xxx.app.ldnuat3.EmailService(); but even now this one is not working either.... this is the web reference i added here ... http://ldnuat3.app.xxx.net/wes/EmailService.asmx?WSDL why is something that worked before now not working.... i have used a lot of web services before.... what the hell is goin' on
  8. CREATE OR REPLACE PACKAGE WES_UAT.MAILSERVICE AS PROCEDURE InsertEMail ( i_SendTo IN EMAIL.SendTo%TYPE, i_SendFrom IN EMAIL.SendFrom%TYPE, i_Subject IN EMAIL.Subject%TYPE, i_EMailBody IN EMAIL.EMailBody%TYPE, i_BodyFormat IN EMAIL.BodyFormat%TYPE, i_Priority IN EMAIL.Priority%TYPE, i_LastUpdated IN EMAIL.LastUpdated%TYPE DEFAULT SYSDATE, i_errorEmailAddress IN EMAIL.errorEmailAddress%TYPE, i_ccEmailAddress IN EMAIL.ccEmailAddress%TYPE, i_systemName IN EMAIL.systemName%TYPE, i_inputDate IN EMAIL.inputDate%TYPE DEFAULT SYSDATE ); PROCEDURE InsertEMail ( i_SendTo IN EMAIL.SendTo%TYPE, i_SendFrom IN EMAIL.SendFrom%TYPE, i_Subject IN EMAIL.Subject%TYPE, i_EMailBody IN EMAIL.EMailBody%TYPE, i_BodyFormat IN EMAIL.BodyFormat%TYPE, i_Priority IN EMAIL.Priority%TYPE, i_LastUpdated IN EMAIL.LastUpdated%TYPE DEFAULT SYSDATE, i_errorEmailAddress IN EMAIL.errorEmailAddress%TYPE, i_ccEmailAddress IN EMAIL.ccEmailAddress%TYPE, i_systemName IN EMAIL.systemName%TYPE, i_inputDate IN EMAIL.inputDate%TYPE DEFAULT SYSDATE ) IS BEGIN INSERT INTO EMail (SendTo, SendFrom, Subject, EMailBody, BodyFormat, Priority, LastUpdated, errorEmailAddress, ccEmailAddress, systemName, inputDate ) VALUES (i_SendTo, i_SendFrom, i_Subject, i_EMailBody, i_BodyFormat, i_Priority, i_LastUpdated, i_errorEmailAddress, i_ccEmailAddress, i_systemName, i_inputDate ); COMMIT; END INsertEMail; The procedure is part of a package... This is the c# that calls it... using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; using System.Web.Mail; using log4net; using MCE.ConfigHandler; namespace WebApplication4 { /// <summary> /// Summary description for WebForm1. /// </summary> public class WebForm1 : System.Web.UI.Page { public OracleConnection _oraConnection = null; public void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here OracleCommand _oraCommand = new OracleCommand(); _oraCommand.CommandText = "MAILSERVICE.InsertEMail"; _oraCommand.CommandType = CommandType.StoredProcedure; _oraCommand.Connection = GetConnection(); _oraCommand.Parameters.Add("i_SendTo", OracleDbType.Varchar2, ParameterDirection.Input).Value = "noel.nicholson@csfb.com"; _oraCommand.Parameters.Add("i_SendFrom", OracleDbType.Varchar2, ParameterDirection.Input).Value = "noel.nicholson@csfb.com"; _oraCommand.Parameters.Add("i_Subject", OracleDbType.Varchar2, ParameterDirection.Input).Value = "noel.nicholson@csfb.com"; _oraCommand.Parameters.Add("i_EMailBody", OracleDbType.Varchar2, ParameterDirection.Input).Value = "noel.nicholson@csfb.com"; _oraCommand.Parameters.Add("i_BodyFormat", OracleDbType.Double, ParameterDirection.Input).Value = 1; _oraCommand.Parameters.Add("i_Priority", OracleDbType.Double, ParameterDirection.Input).Value = 1; _oraCommand.Parameters.Add(" i_errorEmailAddress", OracleDbType.Varchar2, ParameterDirection.Input).Value = "noel.nicholson@csfb.com"; _oraCommand.Parameters.Add(" i_ccEmailAddress", OracleDbType.Varchar2, ParameterDirection.Input).Value = "noel.nicholson@csfb.com"; _oraCommand.Parameters.Add(" i_systemName", OracleDbType.Varchar2, ParameterDirection.Input).Value = "CC"; try { _oraCommand.ExecuteNonQuery(); } catch (OracleException oex) { Response.Write("Failed to execute stored procedure MAILSERVICE.InsertEMail"+"<br/>"+"<br/>"+ oex); } } public OracleConnection GetConnection() { if ( _oraConnection == null ) { _oraConnection = new OracleConnection(SecurityConfig.GetVersionSetting("WebSecurityDB") + SecurityConfig.GetVersionSetting("WebSecurityDBIdentity")); _oraConnection.Open(); } return _oraConnection; } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } } This is the error I am getting... Failed to execute stored procedure MAILSERVICE.InsertEMail Oracle.DataAccess.Client.OracleException ORA-06550: line 1, column 103: PLS-00103: Encountered the symbol ":" when expecting one of the following: ( - + case mod new not null others avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date pipe at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, IntPtr opsSqlCtx, Object src, String procedure, String[] args) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, IntPtr opsSqlCtx, Object src, String[] args) at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery() at WebApplication4.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\webapplication4\webform1.aspx.cs:line 50 The error revolves around the three extra columns i have added and trying to added data to them i_errorEmailAddress, i_ccEmailAddress, i_systemName, I have no idea what the problem is as all the other values work and it seems the exact same..... Can anyone spot the problem,,, I dont think the column values are wrong as two are taken from sysdate so are not there as parameters but i'm not sure :(
  9. can i ask u how long it took u to do that or what way of thinking help u solve the problem,,, i feel so stupid, i've been looking at this for an hour
  10. was given this problem in an interview... anyone got any ideas.... What initial values of a and c are required such that the final values of a and b are: a = 32 b = 4 � int a,b,c a = ? b = 0 c = ? for( b=0; a<12; b++ ) { a = (a+a) * c; }
  11. I have an application that reads data from a database, wraps the data in html table tags and then sent as an email to myself. My problem is as follows. I have set the email format to be html so when I open the email I should see the data in a nice table format. That does not happen however. The email contains a table structure but some of the data at the start is outside the table cells, I looked at the html code and I noticed the following, that certain ! were being added between td tags like the following, <td! > The funny thing is that if I write the html that is being sent to a file like test.html and open it in a browser the table is in perfect format. So what ever way the content is sent, it becomes corrupted... I dont know why... I could paste both samples of code but I want to see if anyone has experienced a problem like this before. Any help would be great...
  12. Getting the follow error from the following code...been trying to fix it for days using System; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Text; namespace WebApplication1 { /// <summary> /// Summary description for WebForm1. /// </summary> public class WebForm1 : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { SqlConnection con; string sql; SqlDataAdapter adExisting; //con = new SqlConnection("Data Source=slon12d11012";User ID=nnichol1;); //con = new SqlConnection("Initial Catalog=DACari;Data Source=slon12d11012;User ID=nnichol1;Password=xxxxx"); //con = new SqlConnection("Data Source=slon12d11012;Initial Catalog=DACari;Integrated Security=SSPI;"); //con = new SqlConnection("Server=slon12d11012;Database=DACari;Trusted_Connection=yes;"); con = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DACari;Data Source=slon12d11012;Packet Size=4096;Workstation ID=WLON110355965;"); sql = "select 'RCRF' as DacType, R.Id, R.AmendmentInstructions as Comments, 'Comment' as TypeOfComment, D.ExternalID as RiskId,D.AmendedByUserId as UserId, D.AmendedDateTime"; sql+="from dbo.ITRR_RCRFDetailComments R, RCRFDetail D"; sql+="where R.Id *= D.Id"; sql+="and R.AmendmentInstructions *=D.AmendmentInstructions"; sql+="union"; sql+="select 'RCRF' as DacType, R.Id, R.ApproverComments as Comments,'RejectedComment' as TypeOfComment,D.ExternalID as RiskId, D.AmendedByUserId as UserId, D.AmendedDateTime"; sql+="from ITRR_RCRFApproverComments R, RCRFDetail D"; sql+="where R.Id *= D.Id"; sql+="and R.ApproverComments *=D.ApproverComments"; sql+="union"; sql+="select 'DAC' as DacType, R.Id, R.Comments, 'Comment' as TypeOfComment,D.RiskId, D.AmendedByUserId as UserId, D.AmendedDateTime from ITRR_DacDetailComments R, DacDetail D"; sql+="where R.Id *= D.Id"; sql+="and R.Comments *=D.Comments"; sql+="union"; sql+="select 'DAC' as DacType, R.Id, R.RejectedComments as Comments,'RejectedComment' as TypeOfComment,D.RiskId, D.AmendedByUserId as UserId, D.AmendedDateTime"; sql+="from ITRR_DacDetailRejectedComments R, DacDetail D"; sql+="where R.Id *= D.Id"; sql+="and R.RejectedComments *=D.RejectedComments"; sql+="union"; sql+="select 'CAP' as DacType, R.CapId, R.Comments, 'Comment' as TypeOfComment, D.CurrentRiskId,D.AmendedByUserId as UserId, D.AmendedDateTime from dbo.ITRR_CAPDetailComments R, CapDetail D"; sql+="where R.CapId *= D.CapId"; sql+="and R.Comments *=D.Comments"; sql+="union"; sql+="select 'CAP' as DacType, R.CapId, R.RejectedComments as Comments,'RejectedComment' as TypeOfComment,D.CurrentRiskId, D.AmendedByUserId as UserId, D.AmendedDateTime"; sql+="from ITRR_CapDetailRejectedComments R, CapDetail D"; sql+="where R.CapId *= D.CapId"; sql+="and R.RejectedComments *=D.RejectedComments"; sql+="union"; sql+="select 'MODAC' as DacType, R.Id, R.MiddleOfficeComments as Comments, 'MiddleOfficeComment' as TypeOfComment, D.RiskId,D.AmendedByUserId as UserId, D.AmendedDateTime"; sql+="from ITRR_MODacDetailComments R, MODacDetail D"; sql+="where R.Id *= D.Id"; sql+="and R.MiddleOfficeComments *=D.MiddleOfficeComments"; sql+="union"; sql+="select 'MODAC' as DacType, R.Id, R.RequestorComments as Comments,'RequestorComment' as TypeOfComment,D.RiskId, D.AmendedByUserId as UserId, D.AmendedDateTime"; sql+="from ITRR_RequestorComments R, MODacDetail D"; sql+="where R.Id *= D.Id"; sql+="and R.RequestorComments *= D.RequestorComments"; adExisting = new SqlDataAdapter(sql,con); con.Open(); DataSet ds = new DataSet(); try { adExisting.Fill(ds,"Existing"); } catch { throw; } finally { con.Close(); } /** System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection (); // TODO: Modify the connection string and include any // additional required properties for your database. conn.ConnectionString = "integrated security=SSPI;data source=slon12d11012;" + "persist security info=False;initial catalog=DACari"; try { conn.Open(); // Insert code to process data. } catch (Exception ex) { Response.Write("Failed to connect to data source"+ex.ToString()); } finally { conn.Close(); } **/ } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } } Server Error in '/WebApplication1' Application. -------------------------------------------------------------------------------- Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. Source Error: Line 75: Line 76: adExisting = new SqlCommand(sql,con); Line 77: con.Open(); Line 78: DataSet ds = new DataSet(); Line 79: try Source File: c:\inetpub\wwwroot\webapplication1\webform1.aspx.cs Line: 77 Stack Trace: [sqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +384 WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\webapplication1\webform1.aspx.cs:77 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
  13. I have this web.config file and I have added a key value describing the connecting string to a db. I'm wondering whats the easiest way to read the value of the connection string from the web.config file, c# is the language i'm using. <?xml version="1.0" encoding="utf-8" ?> <configuration> <!-- define the custom sections used below - do not change --> <appSettings> <add key="ConnectionString" value="DATA SOURCE=DLNOTC02;User Id=snare;Password=snare"/> </appSettings> <system.web> <customErrors mode="Off" /> <compilation defaultLanguage="c#" debug="true"/> <!--<customErrors mode="Off" defaultRedirect="aspx/GlobalError.aspx" />--> <authentication mode="Windows"/> <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/> <sessionState mode="Off"/> <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-GB"/> <webServices> <protocols> <add name="HttpSoap"/> <add name="HttpPost"/> <add name="HttpGet"/> <add name="Documentation"/> </protocols> </webServices> </system.web> </configuration>
  14. i've been calling my functions in c# using the select function_Name from dual , but i'm in a spot of bother now as i cant do this with the boolean function. The reason i did this is because i could not get the code that is used to execute a stored procedure to work with the functions. The code for that includes an execute section that is included for the procedure part. My issue: Is there a simple way to call a boolean oracle function from c# that takes three parameters and returns either true or false...
  15. Permissions are fine Well I can already execute a stored procedure using the same code, so i'm assuming that i can execute a function as well . Am I correct in assuming this
  16. asfdasdf Ya i edited some of the code as it would be too much to view it all. and i dont think the problem is indenting my code either
  17. Below is code that I thought would run a function from asp.net passing it one argument, an id and return one number an integer as well. I am able to call stored procedures from asp.net with code similar to below but those procedures added a row of data to the table. I'm wondering is the procedure slightly different when you try to call a function instead of a stored procedure. I would have thought not since people seem to assume that stored procedures cover both stored procedures and functions. This is the error that I get when I try to call the function Oracle.DataAccess.Client.OracleException ORA-06550: line 1, column 7: PLS-00221: 'COUNTROW' is not a procedure or is undefined ORA-06550: line 1, column 7: PL/SQL: Statement ignored at Project1.xmlApp.GetInt(String[] aParams) in c:\inetpub\wwwroot\project1\xmlapp.aspx.cs:line 273 at Project1.xmlApp.btnRead_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\project1\xmlapp.aspx.cs:line 171 Any help is greatly appreciated. namespace Project1 { /// <summary> /// Summary description for WebForm1. /// </summary> public class xmlApp: System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { /**if(inFileLocation.Value == "") { btnRead.Enabled = false; lblfileLoc.Visible = true; } if(inFileLocation.Value != "") { btnRead.Enabled = true; lblfileLoc.Visible = false; } **/ lblErrors.Visible = false; lblErrors2.Visible = false; lblErrors3.Visible = false; lblErrors4.Visible = false; lblErrors5.Visible = false; } GetInt(arguments); //**************************************************************** }//End of try block catch(XmlException eff) { lblErrors4.Visible = true; lblErrors4.Text ="File not validated"+"</br>" + eff.ToString(); } catch (Exception eg) { lblErrors5.Visible = true; lblErrors5.Text ="Please enter a file path"+"</br>"+ eg.ToString(); } }//End of read method /// <summary> /// Method that is called to execute a stored procedure against the database and return a DataSet. /// </summary> /// <param name="aParams">A set or parameters to populate the command object.</param> /// <returns>A dataset containing the results of the stored procedure.</returns> /// public int GetInt(string[] aParams) { string sConn = GetConnString(); OracleConnection objConn = new OracleConnection(sConn); OracleCommand objCmd; int iResult; try { PopulateCommand(aParams,out objCmd); objCmd.Connection=objConn; objConn.Open(); iResult = Convert.ToInt32(objCmd.ExecuteScalar().ToString()); } catch (Exception ex) { throw ex; } finally { objConn.Close(); } return iResult; } //*********************************************************************************************** private void PopulateCommand(string[] aParams,out OracleCommand objCmd) { objCmd = new OracleCommand(); objCmd.CommandType=CommandType.StoredProcedure; OracleParameter param; for (int i=0;i< aParams.Length;i++) { String par = aParams; if (i==0) { objCmd.CommandText= aParams[0]; Response.Write("<br>"+"<br>"+"<br>"+"<br>"+"<br>"+aParams[0]); }//End if. else { String args = aParams; param = new OracleParameter(args,OracleDbType.Varchar2); param.Direction = ParameterDirection.Input; param.Value = args; Response.Write("<br>"+"<br>"+"<br>"+"<br>"+"<br>"+param); objCmd.Parameters.Add(param); }//End else. }//End for loop. }//End PopulateCommand method. //************************************************************************************************* }
  18. I want to execute a stored procedure from where the name of the stored procedure and the parameters are passed to the method in an array, the name of the stored procedure will always be at array[0] and the remaining parameters will follow... However the number of parameters can vary from 1 to many, any ideas guys (and girls) !
  19. System.DllNotFoundException: Unable to load DLL (OraOps9.dll). at Oracle.DataAccess.Client.OpsTrace.GetRegTraceInfo(UInt32& TrcLevel) at Oracle.DataAccess.Client.OracleConnection..ctor(String connectionString) at Project1.xmlApp.lblDatabase_Click(String[] aParams) in c:\inetpub\wwwroot\project1\xmlapp.aspx.cs:line 261 at Project1.xmlApp.btnRead_Click(Object sender, EventArgs e) in Need to fix this error, have already adjusted the permissions on the local oracle folder to add authenticated users. Does anyone have any ideas.
  20. Exception: System.UnauthorizedAccessException: Access to the path "C:\Temp\test.xml" This was working okay, gave me a problem , thought i had solved it with the following line of code in the web.config file (added <identity impersonate="true"/>) but now the problem is back. This is the method that is giving me the problem, so one said that i may need a finally after the catch section to close the stream that i am opening but i am doing that already at the end of the try section. public void btnValidate_Click(object sender, System.EventArgs e) { if(inFileLocation.Value == "") { lblfileLoc.Visible = true; } int error = 0; try { String loc = inFileLocation.Value; //Response.Write(loc); loc.Replace(@"\",@"\\"); //Response.Write(loc); // Load a document with an inline schema XmlTextReader xtr = new XmlTextReader(loc); // Prepare to validate it XmlValidatingReader xvr = new XmlValidatingReader(xtr); xvr.ValidationType = ValidationType.Schema; // Tell the validator what to do with errors xvr.ValidationEventHandler += new ValidationEventHandler(ValidationHandler); // Load the document, thus validating XmlDocument xd = new XmlDocument(); xd.Load(xvr); // Clean up xvr.Close(); } catch (XmlException ef) { error = 1; lblErrors.Visible = true; lblErrors.Text = "XmlException: " + ef.ToString(); } catch (Exception eg) { error = 1; lblErrors2.Visible = true; lblErrors2.Text ="Exception: " + eg.ToString(); } finally { //may be needed !!! } if (error == 0) { lblValidated.Visible = true; btnValidate.Enabled = false; btnRead.Enabled = true; lblErrors.Visible = false; lblErrors2.Visible = false; lblErrors3.Visible = false; } }//End of upload method. public void ValidationHandler(object sender, ValidationEventArgs e) { // Dump any validation errors to the UI lblErrors3.Visible = true; lblErrors3.Text = e.Message; } Exception: System.UnauthorizedAccessException: Access to the path "C:\Temp\test.xml" is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) at System.Xml.XmlTextReader.CreateScanner() at System.Xml.XmlTextReader.Init() at System.Xml.XmlTextReader.Read() at System.Xml.XmlValidatingReader.ReadWithCollectTextToken() at System.Xml.XmlValidatingReader.Read() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at Project1.xmlApp.btnValidate_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\project1\xmlapp.aspx.cs:line 98 This section gives the following block of ugly errors, i've already spend about 3 hours on the problem and they all give the same solution about changing the permissions on the file. But I am already the creator of the file, and the groups that others have talked about like the network group are there already... Could some help plz
×
×
  • Create New...