I want to read a text file and separate the data and write it back to another text file. So the input file content is like 07090000079011110225000 00001000100010118832 032111050111205011110501111022500000FL .... I know that first 3 characters are for CompanyID, next 2 are for Symbol etc. How Can I put it together? I used to write in VB code like this below using a Type and define the width there.(easy to maintain) How can I do that in VB.Net or c#?
[Code]....
So the output will be like CompanyID : 070 Symbol :90 .
I have a text file stored in my sql DB. in that .txt file I have certain numbers like:
99435 87889 33455 33555 34556
How to get the count of these numbers from the txtfile stored in the database? Also to read the file and fetch the number one by one in a string? I am using asp.net (C#)
I have a project of ASP.NET which is a Customer satisfaction Survey, i need to to incorporate the option selected by customer with the a client side text file which i located at the client machine, read a text file on client or should i develop the survey application as window application.
I have some code in my default.apsx.cs file that all works except one very small but important piece.. I have the same code in c# consoleapp and it works fine on my local machine.
Here is the code...
[code]...
When i try and run it through visual web developer it seems to feel the file doesnt exits so evaluates the if statement to false and moves. on... I havent specified a path and have the file in the same folder as the default.aspx.cs file.
I have a txt file, in which read only property is true. When I try to write some text in that file through the vb coding, it's through the error. I have shown the code below.
Dim fs As FileStream = File.OpenWrite(HttpContext.Current.Server.MapPath("Include/CacheKeyFile.txt")) Dim sw As New StreamWriter(fs) sw.Write("Menu setup updated by " & value & " on " & DateTime.Now.ToString()) sw.Close() fs.Close()
I found the cause of the error. If we set the Write access property to false, we can open the file and write it without showing the error messages.
I need to remove the Read only property for a file through the vb. Net code. Is it possible? Can we set the read only for txt file before open and write operation?
How do I read/write a text file on another server from a web page.I get the error "Access to the path '//Server2/mydatafiles/test.txt' is denied". I do not get the error if I am running the browser on the server where the files exist.I think I need to set permissions on the destination server in some way.
I'd like to create a class library project where embed resources like js, css and maybe image files. I would compile it and copy the dll into the bin folder of my web site to include the resources into my pages with GetWebResourceUrl.
I tried with an assembly that have no .cs files, but it doesn't seem to work, I can't see the namespace of the assembly in the web project.
I have an asp.net 4.0 web application.I need extensive configuration data for this web application, that is strongly typed and the structure of this configuration data is going to be fairly complex (cannot do with key-value pairs). In the past I remember having done this in .Net 2.0 but cannot figure out how I will do it in .Net 4.0. The class and config mapping is like shown below (really simplified for the purpose of illustration only):
I'm using a book to create a shopping site and need to change the following code so that the current dropdown list, of colour options, is replaced by just read only text. I'm a novice and despite best efforts I can't fathom it out. If anyone can change the code for me I would be extremely grateful.
The code below is the code-behind page for a Product List page where I want each product displayed to also display its colour options as just text (I don't need the shopper to select a colour choice until they click through to the detail page)
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; public partial class UserControls_ProductsList : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { PopulateControls(); } private void PopulateControls() { // Retrieve DepartmentID from the query string string departmentId = Request.QueryString["DepartmentID"]; // Retrieve CategoryID from the query string string categoryId = Request.QueryString["CategoryID"]; // Retrieve Page from the query string string page = Request.QueryString["Page"]; if (page == null) page = "1"; // Retrieve Search string from query string string searchString = Request.QueryString["Search"]; // How many pages of products? int howManyPages = 1; // pager links format string firstPageUrl = ""; string pagerFormat = ""; // If performing a product search if (searchString != null) { // Retrieve AllWords from query string string allWords = Request.QueryString["AllWords"]; // Perform search list.DataSource = CatalogAccess.Search(searchString, allWords, page, out howManyPages); list.DataBind(); // Display pager firstPageUrl = Link.ToSearch(searchString, allWords.ToUpper() == "TRUE", "1"); pagerFormat = Link.ToSearch(searchString, allWords.ToUpper() == "TRUE", "{0}"); } // If browsing a category... else if (categoryId != null) { // Retrieve list of products in a category list.DataSource = CatalogAccess.GetProductsInCategory(categoryId, page, out howManyPages); list.DataBind(); // get first page url and pager format firstPageUrl = Link.ToCategory(departmentId, categoryId, "1"); pagerFormat = Link.ToCategory(departmentId, categoryId, "{0}"); } else if (departmentId != null) { // Retrieve list of products on department promotion list.DataSource = CatalogAccess.GetProductsOnDeptPromo (departmentId, page, out howManyPages); list.DataBind(); // get first page url and pager format firstPageUrl = Link.ToDepartment(departmentId, "1"); pagerFormat = Link.ToDepartment(departmentId, "{0}"); } else { // Retrieve list of products on catalog promotion list.DataSource = CatalogAccess.GetProductsOnFrontPromo(page, out howManyPages); list.DataBind(); // have the current page as integer int currentPage = Int32.Parse(page); } // Display pager controls topPager.Show(int.Parse(page), howManyPages, firstPageUrl, pagerFormat, false); bottomPager.Show(int.Parse(page), howManyPages, firstPageUrl, pagerFormat, true); } // Executed when each item of the list is bound to the data source protected void list_ItemDataBound(object sender, DataListItemEventArgs e) { // obtain the attributes of the product DataRowView dataRow = (DataRowView)e.Item.DataItem; string productId = dataRow["ProductID"].ToString(); DataTable attrTable = CatalogAccess.GetProductAttributes(productId); // get the attribute placeholder PlaceHolder attrPlaceHolder = (PlaceHolder)e.Item.FindControl("attrPlaceHolder"); // temp variables string prevAttributeName = ""; string attributeName, attributeValue, attributeValueId; // current DropDown for attribute values Label attributeNameLabel; DropDownList attributeValuesDropDown = new DropDownList(); // read the list of attributes foreach (DataRow r in attrTable.Rows) { // get attribute data attributeName = r["AttributeName"].ToString(); attributeValue = r["AttributeValue"].ToString(); attributeValueId = r["AttributeValueID"].ToString(); // if starting a new attribute (e.g. Color, Size) if (attributeName != prevAttributeName) { prevAttributeName = attributeName; attributeNameLabel = new Label(); attributeNameLabel.Text = attributeName + ": "; attributeValuesDropDown = new DropDownList(); attrPlaceHolder.Controls.Add(attributeNameLabel); attrPlaceHolder.Controls.Add(attributeValuesDropDown); } // add a new attribute value to the DropDownList attributeValuesDropDown.Items.Add(new ListItem(attributeValue, attributeValueId)); } } }
I have a floating div on my page that contains an image. While everything looks ok in VisualStudio 2008, when I post the page to my server, the text in the image below the upper div shifts to the left of the div.
You can see the problem in the top paragraph at this url [URL]
Is there any way to read the prt file with sample data like that and seperate headers and take the data from the file. Sample prt file data - Sample.prt Item Sub Group :..............................
I have .vcf file which have multiple contacts. i have to read those contacts data and store it in my database using c#.net . i have done the reasearch but im only getting code to store .csv data to database but i want to store data from .vcf file.