Showing posts with label character. Show all posts
Showing posts with label character. Show all posts

Wednesday, March 28, 2012

How do I loop through dataset then replace?

How would I loop through the rows of a dataset, then replace certain character in a certain column?

I have a database which has a date field formatted 23/08/2007, I wish to loop through the dataset containing the results from the dataset, change the format of the date to 23.08.2007 then store the value back into the dataSet, which is called 'dataSet', and the table is called 'News'.

Using C# by the way.

Thanks in advance

I suggest you to do this in database level though stored procedure that is dynamic (receive your changing criteria via input parameters).
Looping in stored procedures can be done though cursor (I know it is not recomended to use cursor in database for performance issue, but I think in this case it will be much better than looping into your application).

Tip:
You can get many date format for your DATETIME column in database. For example try: Convert(varchar(25), MyDateTimeColumn,113) or Convert(varchar(25), MyDateTimeColumn,111) [Used SQL Books Online for more samples and examples].

Good luck.

|||

Thanks

I'm new to this, so I'll read up on stored procedures, infact, I'm sure I have a whole book on SQL somewhere.

|||

While I read up on stored procedures can someone tell me how to do this in the application? The dataset will only contain 3 rows so it shouldnt have too much of an effect on the application.

|||

If it is just 3 records, then it will not affect the performance that much!

Here is the idea:
Let yourSqlDataAdapterfillyourDataSet.
Now, you have the data in the DataSet, loop into those records in DataSet.
Use String.Replace for replacing issue you have.

http://msdn2.microsoft.com/en-us/library/system.string.replace(VS.71).aspx

Good luck.

|||

What I wanted to do was get data from a database in date order, then alter the format of the date once it was in the dataset.

Instead of faffing about with it, I simply set the date in the database twice, i.e. Date, then a display date.

Now the data is sorted using the Date, but it's the displayDate field which displays the date to the user.

Thanks for all the help

Sunday, February 19, 2012

How do i display a checkbox on a report?

Hi,
I've been trying to display a checkbox on a report using unicode text eg. ? (U+2616) (Arial Unicode MS). I get the error: BC30037: Character is not valid. I have read somewhere about using html formatting to display it, how could this be done?
Is there any thing else i could do?

Thanks,
Sam.I've managed to fix the error, simple mistake. Why is it there are very few controls in reporting services compared with access? Is it possible to create custom controls for reports?
Thanks.|||I've been trying to show a boolean value in the database on the report with either a checkbox, Yes/No, or something easyfor a non-technical user to read.(definitely not True/False) Can you please tell me how to put together the expression with the dataset valuse? How to display unicode characters?|||

I got my solution finally. Stupid me that didn't know I can open up the expression editor to choose functions from, and didn't know I can right-click the field to open up expression editor.

Thanks anyway.

|||

I"m interested in seeing your solution. Can you post as reply to this thread? I'll bet a lot of us report designers could use this little tidbit.

thanks,

|||

please post the code for this issue.

thanks.

|||

textbox
set properties
Borderstyle
Default = Solid
Font
FontFamily = Wingdings2

Expression
Value =iif( Fields!....Value = "True", "P", "" )

How do i display a checkbox on a report?

Hi,
I've been trying to display a checkbox on a report using unicode text eg. ? (U+2616) (Arial Unicode MS). I get the error: BC30037: Character is not valid. I have read somewhere about using html formatting to display it, how could this be done?
Is there any thing else i could do?

Thanks,
Sam.I've managed to fix the error, simple mistake. Why is it there are very few controls in reporting services compared with access? Is it possible to create custom controls for reports?
Thanks.|||I've been trying to show a boolean value in the database on the report with either a checkbox, Yes/No, or something easyfor a non-technical user to read.(definitely not True/False) Can you please tell me how to put together the expression with the dataset valuse? How to display unicode characters?|||

I got my solution finally. Stupid me that didn't know I can open up the expression editor to choose functions from, and didn't know I can right-click the field to open up expression editor.

Thanks anyway.

|||

I"m interested in seeing your solution. Can you post as reply to this thread? I'll bet a lot of us report designers could use this little tidbit.

thanks,

|||

please post the code for this issue.

thanks.

|||

textbox
set properties
Borderstyle
Default = Solid
Font
FontFamily = Wingdings2

Expression
Value =iif( Fields!....Value = "True", "P", "" )

How do i display a checkbox on a report?

Hi,
I've been trying to display a checkbox on a report using unicode text eg. ? (U+2616) (Arial Unicode MS). I get the error: BC30037: Character is not valid. I have read somewhere about using html formatting to display it, how could this be done?
Is there any thing else i could do?

Thanks,
Sam.I've managed to fix the error, simple mistake. Why is it there are very few controls in reporting services compared with access? Is it possible to create custom controls for reports?
Thanks.|||I've been trying to show a boolean value in the database on the report with either a checkbox, Yes/No, or something easyfor a non-technical user to read.(definitely not True/False) Can you please tell me how to put together the expression with the dataset valuse? How to display unicode characters?|||

I got my solution finally. Stupid me that didn't know I can open up the expression editor to choose functions from, and didn't know I can right-click the field to open up expression editor.

Thanks anyway.

|||

I"m interested in seeing your solution. Can you post as reply to this thread? I'll bet a lot of us report designers could use this little tidbit.

thanks,

|||

please post the code for this issue.

thanks.

|||

textbox
set properties
Borderstyle
Default = Solid
Font
FontFamily = Wingdings2

Expression
Value =iif( Fields!....Value = "True", "P", "" )