Jump to content
Xtreme .Net Talk

cathiec

Avatar/Signature
  • Posts

    29
  • Joined

  • Last visited

cathiec's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. 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
  2. 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
  3. 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
  4. 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!
  5. thanks! i used the DataTextFormatString like so: DropDownList1.DataTextFormatString ="{0:d}"; this gives me the date in the format dd/mm/yyyy
  6. 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!
  7. 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
  8. 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
  9. 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,
  10. 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)
  11. 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?
  12. 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!
  13. 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(); }
  14. 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!
  15. 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.
×
×
  • Create New...