
cathiec
Avatar/Signature-
Posts
29 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by cathiec
-
i have used the Tutorial: Exporting to Multiple Formats in the business objects help file. this teaches you how to create a report and export this to file formats such as .pdf, .xls,.doc etc. I get the error "Invalid report file path. " when i try to export the report. it is in the procedure # Public Sub ExportSetup() exportPath = "C:\Exported\" If Not System.IO.Directory.Exists(exportPath) Then System.IO.Directory.CreateDirectory(exportPath) End If myDiskFileDestinationOptions = New DiskFileDestinationOptions() myExportOptions = TestCrystalReport.ExportOptions 'this is where the error fires myExportOptions.ExportDestinationType = ExportDestinationType.DiskFile End Sub i really would appreciate any help on this. thanks and regards
-
Hi! I am trying to export to PDF using vb.net and crystal. here is the code that i am using: Private Sub Export() Dim ExportPath As String = Request.PhysicalApplicationPath Dim crReportDocument As CrystalReport1 = New CrystalReport1() crReportDocument.SetDataSource(Me.DataSet1) crDiskFileDestinationOptions = New DiskFileDestinationOptions crExportOptions = crReportDocument.ExportOptions Session("filename") = Session.SessionID.ToString() & ".pdf" crDiskFileDestinationOptions.DiskFileName = ExportPath & Session("filename").ToString() crExportOptions.DestinationOptions = crDiskFileDestinationOptions crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat crReportDocument.Export() Response.Redirect("WebForm2.aspx") End Sub i have imported the crytal namespaces that i need and i have added references to the project too. i have a crystal report called CrystalReport1 also. but i keep getting the error "Type 'CrystalReport1' is not defined" Would really appreciate any help on this. thanks and regards
-
hi! i have a stored procedure that is used for debt collection. the query sums the amount owed by each debtor if the transaction date is 90 or more days before the parameter date entered by the user (asp.net front- end) so i get an output like this in a spreadsheet. Debtor No Amount Outstanding 1 1000 2 5555 3 600 i need to alter this so that i get 3 more columns so that the output would look like this Debtor No Amount Outstanding 1-30 days 31-60d ays 61-90 days so that i get a break down of what is less than 30 days overdue, less than 60 days overdue and what is 90 days overdue. currently i use: convert(datetime,convert(varchar(8),SE.TRANS_DATE)) <= DATEADD(DAY, -90, @pDateEntered) in the where clause and i select Debtor_Number, SUM(Amount) i really would appreciate any suggestion as to how i would go about doing this. thanks
-
i have a list box that contains 12 dates (4 quarters for 3 years) i also have a drop down list that contains one of these dates. the listbox is populate from a table that i created to hold the 12 dates. the date in the drop down comes from another database table. i am performing an update functionality so i want to show the original info with the date in the dropdownlist and then give the user the option to change this date to one of the dates in the list box. but it is confusing to the user if the two dates dont initially correspond before updateing the date. i want the date in the listbox to be selected that is the same as the date in the dropdownlist that is selected on page load - as in the first date in the dropdownlist. i want to write back the selected date to the DB but if the user doesnt want to change the date then i want it to be selected by default i really would appreciate any help!
-
thanks! i used the DataTextFormatString like so: DropDownList1.DataTextFormatString ="{0:d}"; this gives me the date in the format dd/mm/yyyy
-
i have a datetime field in sql server table - PAYMENTDATE. i select this using a stored procedure and populate a dropdownlist in ASP.NET with the values that are returned. this is the code that i use: if(ds.Tables[0].Rows.Count!=0) { DropDownList1.DataSource = ds; DropDownList1.DataMember = "CLAIMSPERD_EMF"; DropDownList1.DataTextField = "ACTIVE_PERIOD"; DropDownList1.DataBind(); } this all works fine but the date appears in the dropdownlist with as a date and time field (the time is 00:00:00) so it might look something like this: 2001-09-30 00:00:00.000 i don't store the time initially in the field and i don't need it either. is there a way to remove this 00:00:00 from the date in the dropdownlist. in the table in sqlserver the date is stored as 2001-09-30 when i return all rows but if i use query analyser and run a query the date comes back ike 2001-09-30 00:00:00.000 any help would be much appreciated! thanks!
-
I have a main application that manages authentication and authorisation to other applications (all ASP.NET with C#) Is it possible to transfer a sessionid or store details in a cookie so that security informaion/particular access information applied by the main application will cascade to the other applications?? In other words can i use a session id created by one application in another?? Thanks
-
I have the following piece of code that is supposed to open a file in a new browser window. sb.Append("<SCRIPT>"); sb.Append("window.open('DemoFiles/" + strFilename + "');"); sb.Append("</SCRIPT>"); Response.Write(sb.ToString()); sb is a StringBuilder object Reports is the name of the folder where i want to the files to be created strFileName is the name of the file that i want to open The user clicks a button and the file is created in the folder and opens when i build and browse from the visual studio.NET application. When i try to navigate to the form from a browser the forms appears but when i click the button the file is created in the folder but does not automatically open like it does in visual studio. i would greatly appreciate any suggestions Regards, cathiec
-
I am using a memory stream object and i want to use the create stream method to display a dataset in the browser window. I get the error: "Cannot implicitly convert type 'System.IO.Stream' to 'System.IO.MemoryStream'" on the line: s = SF.CreateStream(GetData()); s is the memory stream object SF is an object of the eXport.NET class (an add on that we use to export excel documents to browser - it supports the create stream method) GetData() is the method that returns the dataset private DataSet GetData() { SqlDataAdapter da; DataSet ds; ds = new DataSet(); da = new SqlDataAdapter("stpDEBgetInsuranceMailMerge", strConnection); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.Fill(ds); return(ds); } i would greatly appreciate any suggestions,
-
i am using an add-on component called eXport.net to export data to an excel worksheet. the sheet must first be saved on the webserver before naything can be done with it. i then include some inline javascript to open the excel spresdsheet in a new window. everything works fine up until the opening of the file in a new window. the file is created on the webserver but will not open up in a new browser window for me. below is the code i am using: SqlDataAdapter da; DataSet ds; ds = new DataSet(); da = new SqlDataAdapter("stpDEBgetInsuranceMailMerge", strConnection); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.Fill(ds, "SSRFADD"); eXportNET SF = new eXportNET(); String strFileName; StringBuilder sb = new StringBuilder(); SF.FileType = "XLS"; SF.SavePath = Server.MapPath(""); strFileName = SF.CreateFileFromDataset(ds); strFileName = strFileName.Substring(strFileName.LastIndexOf("\\")+1); sb.Append("<SCRIPT>"); sb.Append("window.open('" + strFileName + "');"); sb.Append("</SCRIPT>"); Response.Write(sb.ToString()); this works from within visual studio when i build and browse but the minute i copy and paste the link into a browser window and click on Export Report button i get the file is created but nothing happens -(no window opended up showing the file)
-
i am using forms authentication. in my web.config i have <authentication mode="Forms"> <forms loginUrl = "Logon.aspx" name = "adAuthCookie" timeout = "60" path="/"> /forms> </authentication> <authorization> <deny users = "?"/> <allow users = "*"/> </authorization> my program contains logic to authorize what the user is allowed to access. A user clicks on a hyper link in a datagrid to access a form. The logic in the program determines whether the user is authorized to see this form of not. the problem is that when the link is clicked on then a windows pop up appears asking for username and password and authorizes the user to view the page even if the code that i have written does no authorize. windows seems to be over -riding what i have configured the program to do. if i remove the authorization element from the webconfig then the user is not authorized to view anything. does anyone know how to solve this?
-
i have a project and i want to make a complete copy of this project so that i can work on the copy and notupset the original. my problem is that whatever way i try to copy the project it links back to the original and makes the changes that i have made to the copy there too. i have tried the copy project method and i also tried creating a blank solution and copying the project in here but i get the same problem and if i try to change the name of the copied project then i get errors also. does anyone know how to do this? thanks!
-
Hi! Thank you so much for the reply. This was driving me crazy! After a lot of research I found out that the "memberOf" property does not supply the user's primary groups. This is why the other goups were being supplied and not Domain Users and also why if a user was only a member of Domain Users then no group was supplied. I came up with the following solution which is similar to yours but uses the security id to find all the groups that the user is part of including Primary groups and nested groups. (below is the c# version but this article http://www.wwwcoder.com/main/parentid/260/site/2208/68/default.aspx explains the situation and supplies the code in vb.) public string Groups(string domain, string username, string pwd) { byte[] sid = null; string domainAndUsername = domain + @"\" + username; StringBuilder groupNames = new StringBuilder(); DirectoryEntry rootEntry = new DirectoryEntry(_path, domainAndUsername, pwd); try { rootEntry.RefreshCache(new string[] {"tokenGroups"}); foreach (object groupSid in rootEntry.Properties["tokenGroups"]) { sid = ((byte[])(groupSid)); DirectoryEntry groupEntry = new DirectoryEntry(string.Format("LDAP://<sid={0}>", ConvertToOctetString(sid))); PropertyCollection propcoll = groupEntry.Properties; //loop through all of the properties for this record foreach (string key in propcoll.PropertyNames) { //loop through all the values associated with our key foreach (object values in propcoll[key]) { if (key.ToLower() == "distinguishedname") { string temp = values.ToString(); int equalsIndex, commaIndex; equalsIndex = temp.IndexOf("=", 1); commaIndex = temp.IndexOf(",", 1); if (-1 == equalsIndex) { return null; } groupNames.Append(temp.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1)); groupNames.Append("|"); } } } } } catch (Exception ex) { //process exception } return groupNames.ToString(); } public static string ConvertToOctetString(byte[] values) { return ConvertToOctetString(values, false, false); } public static string ConvertToOctetString(byte[] values, bool isAddBackslash) { return ConvertToOctetString(values, isAddBackslash, false); } //This is where the work really comes in. This method allows us to convert the sid //into a usable string that LDAP can use to search for the groups this user belongs to. public static string ConvertToOctetString(byte[] values, bool isAddBackslash, bool isUpperCase) { int iterator = 0; System.Text.StringBuilder builder = null; string slash = ""; if (isAddBackslash) { slash = "\\"; } else { slash = string.Empty; } string formatCode = ""; if (isUpperCase) { formatCode = "X2"; } else { formatCode = "x2"; } builder = new System.Text.StringBuilder(values.Length * 2); for (iterator = 0; iterator <= values.Length - 1; iterator++) { builder.Append(slash); builder.Append(values[iterator].ToString(formatCode)); } return builder.ToString(); }
-
the function should bring back the groups that the user is part of. it does this but will never return the group "domain users" for any user. that is why i was trying to check to see if result was null and then just default to "domain users". i dont think that approach is going to work. i need to find out why the function will no recognise that the user is a member of "domain users". In the active directory the attribute member of contains the groups that a user is a member of and "domain users" is there but its like the function will not process domain users but will return all other groups. i know this isnt technically a c# question but its driving me crazy!! i would really appreciate any help!
-
thanks for the help everyone!!! i have being doing a little more research and i think that my problem is that FindOne() does not return an empty string or a null. It seems to return the first entry that it finds and skips past the null/empty ones. so my idea of exiting the function wont work here.
-
i have recently used the article http://msdn.microsoft.com/library/en-us/dnnetsec/html/SecNetHT02.asp?frame=true to implement forms-based authentication. i am having a problem with the GetGroups method. The method will not return the group name of a user that is currently in the Domain Users group only. I get the error: Error authenticating. Error obtaining group names. Object reference not set to an instance of an object The program runs perfectly and returns group names for users that are members of other groups. If a user is a member of four groups including the Domain Users group then the other three group names are returned.
-
i tried this but i get the error: An object of a type convertible to 'string' is required
-
is there a way in c# to exit out of a function like in vb (exit function) i am using a variable and an if statement. if this variable is null i want to exit out of the function without continuing with the rest of the vode in the function. try { SearchResult result = search.FindOne(); //i want to exit the procedure here if result is 0 if(result == null) { ??????????? } int propertyCount = result.Properties["memberOf"].Count; String dn; int equalsIndex, commaIndex; for( int propertyCounter = 0; propertyCounter < propertyCount; propertyCounter++) { dn = (String)result.Properties["memberOf"][propertyCounter]; equalsIndex = dn.IndexOf("=", 1); commaIndex = dn.IndexOf(",", 1); if (-1 == equalsIndex) { return null; } groupNames.Append(dn.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1)); groupNames.Append("|"); } } catch(Exception ex) { throw new Exception("Error obtaining group names. " + ex.Message); }
-
I export a crystal report to the solution folder at the moment. i want to export the reports to a folder called REPORTS on the server. I use the following code to export the reports: rptBuildByDate crReportDocument = new rptBuildByDate(); crReportDocument.SetDataSource(this.dstBuildPDF2); string ExportPath; ExportPath = Request.PhysicalApplicationPath; crDiskFileDestinationOptions = new DiskFileDestinationOptions(); crExportOptions = crReportDocument.ExportOptions; Session["filename"] = Session.SessionID.ToString() + ".pdf"; crDiskFileDestinationOptions.DiskFileName = ExportPath + Session["filename"].ToString(); crExportOptions.DestinationOptions = crDiskFileDestinationOptions; crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; crReportDocument.Export(); Response.Redirect("Webform2.aspx"); //redirected to webform2 so that the browser back button //will bring you back to the webform that the report //is run from webform2.aspx: public class WebForm2 : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here string fName; fName = ExportPath + Session["filename"].ToString(); crDiskFileDestinationOptions.DiskFileName = fName; Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.WriteFile(fName); Response.Flush(); Response.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 }
-
I have a login page where a number is entered in a text box. When a button is clicked the number is stored in a session variable and Response.Redirect is used to navigate to the next webform. Vaious operations occur on this form - updating, deleting data etc. When i use the browser back button to return to the first form the browser brings me back through all the states that the second form was in and eventually arrives at the first form. I created a back button that uses Response.Redirect to navigate back to the first form. My problem is that I still want the number to be populated in the textbox when this back button is used. The number is still in the textbox when the browser back button is used but that is messy. I tried to use a session variable to populate the textbox but as this is the firat "login page" of the application it will not open as i get the error "object not set to reference" when i try to build the app. Any help please??
-
i have one grouping called Group #1. I group on a field called asset code. The detail setion contains several lines for each asset code. I also created a subtotal field for each group. I want to use the drill down functionality so that when the report is first run the group name is shown and the subtotal. I want to give the user the functionality to drill down to view the details if the so wish. i right click on the detail section and click: Hide (drill down ok) but when i run the report the group with the subtotal is visible but i cannot drill down to the data for each group. i am new to crystal. please help!
-
i have one grouping called Group #1 in my crystal report. I group on a field called asset code. The detail setion contains several lines for each asset code. I also created a subtotal field for each group. I want to use the drill down functionality so that when the report is first run the group name is shown and the subtotal. I want to give the user the functionality to drill down to view the details if the so wish. i right click on the detail section and click: Hide (drill down ok) but when i run the report the group with the subtotal is visible but i cannot drill down to the data for each group. i am new to crystal. please help!
-
a column in my db is called cost. the type of this column is float. i am using visual studio . NET. A user enters the cost into a textfield on the form. i use the code: float fCost = Convert.ToInt64(TextBox9.Text); this works fine when numbers are entered into TextBox9.Text but when i try to enter a cost with a decimal point eg 9.99 i get an error. when i use double fcost = Convert.ToDouble(TextBox9.Text); the error says cannot convert from double to float. any suggestion?
-
i have a form on which the primary key is the employee number. the user is required to enter training needs, time scale and cost for each employee number. the problem is that there can be more than one entry for trainings needs cost and time scale. i ahve designed the form so that there are 8 times the information can be added. my problem comes when i try to insert as i am setting the parameters for the stored procedure equal to specici text boxs and drop down lists instead of the 8. here is my code private void Button1_Click(object sender, System.EventArgs e) { //SqlConnection conn = new SqlConnection("data source=NT20'\'SQL02;initial catalog=webholidays;integrated security=SSPI;persist security info=False;workstation id=PC2677;packet size=4096"); SqlDataAdapter da; DataSet ds; SqlParameter workParam; da = new SqlDataAdapter("stpGetEmpDetails", sqlConnection1); da.SelectCommand.CommandType = CommandType.StoredProcedure; workParam = new SqlParameter("@pEmpNum", System.Data.SqlDbType.VarChar); workParam.Direction = ParameterDirection.Input; workParam.Value = txtEmpNum.Text; da.SelectCommand.Parameters.Add(workParam); ds = new DataSet(); da.Fill(ds, "dbo.pdp_emp"); txtDirectorate.Visible = true; lblDirectorate.Visible = true; txtDept.Visible = true; lblDept.Visible = true; txtName.Visible = true; lblName.Visible = true; txtDirectorate.Text = (string) ds.Tables[0].Rows[0]["Directorate"].ToString().Trim(); txtDept.Text = (string) ds.Tables[0].Rows[0]["Department"].ToString().Trim(); txtName.Text = (string) ds.Tables[0].Rows[0]["EmpName2"].ToString().Trim(); lblTrainNeeds.Visible = true; lblTime.Visible = true; lblCosts.Visible = true; TextBox1.Visible = true; TextBox2.Visible = true; TextBox3.Visible = true; TextBox4.Visible = true; TextBox5.Visible = true; TextBox6.Visible = true; TextBox7.Visible = true; TextBox8.Visible = true; TextBox9.Visible = true; TextBox10.Visible = true; TextBox11.Visible = true; TextBox12.Visible = true; TextBox13.Visible = true; TextBox14.Visible = true; TextBox15.Visible = true; TextBox16.Visible = true; DropDownList1.Visible = true; DropDownList2.Visible = true; DropDownList3.Visible = true; DropDownList4.Visible = true; DropDownList5.Visible = true; DropDownList6.Visible = true; DropDownList7.Visible = true; DropDownList8.Visible = true; btnSave.Visible = true; } private void btnSave_Click(object sender, System.EventArgs e) { string vEmpNum = txtEmpNum.Text; string vTrainNeeds = TextBox1.Text; string vTime = DropDownList1.SelectedItem.Value.ToString(); float fCost = Convert.ToInt32(TextBox9.Text); insertUser(vEmpNum, vTrainNeeds, vTime, fCost); } private void insertUser(string vEmpNum, string vTrainNeeds, string vTime, float fCost){ //Create parameters SqlParameter Parm1 = new SqlParameter("@pEmpNum",vEmpNum); SqlParameter Parm2 = new SqlParameter("@pTrainNeeds",vTrainNeeds); SqlParameter Parm3 = new SqlParameter("@pTime",vTime); SqlParameter Parm4 = new SqlParameter("@pCost",fCost); sqlConnection1.Open(); //Create SQLCommand SqlCommand cmd = new SqlCommand("stpInsertUser", sqlConnection1); //Add parameters to the SQL Command cmd.Parameters.Add(Parm1); cmd.Parameters.Add(Parm2); cmd.Parameters.Add(Parm3); cmd.Parameters.Add(Parm4); //Set the Command Type to Storeed Procedure cmd.CommandType = CommandType.StoredProcedure; //Execute stored Procedure cmd.ExecuteNonQuery(); }
-
sorry, i forgot to mention that i have a formula field called @Date {ma_asset.TRANS_DATE} > {?FromDate} and {ma_asset.TRANS_DATE} < {?ToDate} i think that this is where my problem lies but i just cant get the syntax right to say: select all rows from the view where the dates are between the ?FromDate and the ?ToDate