DataSource Controls :: How To Remove Characters From A Dataset
Feb 14, 2011
I'm trying to remove extraneous characters like quotes, commas, etc from my dataset. I get the fact in the standard way of doing things in your code behind you simply go
string data = data.replace(",",""); or something like this. However, a datasource doesn't seem to give me that capability. What can I do to make it do this? I'm importing data from an excel sheet into a gridview. The commas are goofing up my view. I'd like to replace any commas in the dataset with spaces. Here is the code I have.
how do i copy required row in dataset to a new dataset. i have bind a xml into a dataset and i need to display say row 3 to 5 only so i do a for loop but i have encounter problem when trying to copy the rows to a new dataset.
do i have to write the xml to datatable and bind it to dataset and from there copy over ?
I have users emails in my database and when i retrieve those usernames, i want to remove every charecter after the @ charecter in the email for example, i have myname@domain.com i want to cut that to myname.
i want to display values in dropdownlist using querystring[which is successfully happening] but the problem is when id passed in querystring is 7.17 then in dropdownlist it is displaying values as 7 . 1 7....but i want to display it as 7 and 17...
I've wrote this little method to achieve the goal in the subj., however, is there more efficient (simpler) way of doing this? who will search for this like I did.
var fileName = new System.Text.StringBuilder(); fileName.Append("*Bad/ :, Filename,? "); // get rid of invalid chars while (fileName.ToString().IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) > -1) { fileName = fileName.Remove(fileName.ToString().IndexOfAny(System.IO.Path.GetInvalidFileNameChars()), 1); } ?
I am looking a regular expression that will remove all of the text except for the charachters that comes after the last "-" character. in this way I can get the ID for a URL.
[URL] so that after the regular expression will be exutes I will have "t43g2g" ID.
I am using a master page and I need to change how the <title> element is rendered. The <title> content renders as expected. The problem is the whitespace that bounds my <title> element. I want to get rid of it.How do I remove the leading and trailing characters
I'm using SQL Server 2005 and am getting security errors when the user enters certain characters in the aspx page. For example, the simple string,
&#
causes an error. How do I allow the user to enter anything they want and keep the site secure? In my VB all fields are sent with Parameters.AddWithValue.
I developed a website using asp.net 2.0 and sql server 2005. I m using Turkish language content as entries to database tables. But when I try to add any record from my web interface I see strange characters. for example "ş,ğ,İ," characters are viewed like Å,? characters. I set my globalization to culture turkish in web.config. So there s no problem with static data on the page and no problem with records I added earlier in my own machine. I just need to send data in a correct encoding to the database.I first thought it was about collation, but changing collation doesn t differ data sent to database, I think I need to do something from my web app, but still couldn't get any ideas.
how do I go about inserting into a database special characters such as the uppercase O, umlaut Ö Please understand that I have been able to insert the special character from inside MMS by putting an N in front of the value but when I run the SQL file from inside an ASP.net 4.0 page it comes up as a diamond with a question mark in it
how can i find the value in the field which contain "," and remove it in sql e.g:
the field is: 11,12,13 how can i find 12 and remove it becomes=> 11,13 if the field is 12,13,14==> 13,14 if the field is 9,10,11,12 ==> 9,10,11 if the field is 12 only ,then result is empty
In myapp, I can create two datasets: [dstServer1] and [dstServer2]. They are coming from two tables which are in two different SQL server: [Order1] (in server1) and [Order2] (in server2). These two tables have the same data structure. How to code to compare two dataset and then insert difference into another table without using linked server?