Showing posts with label app. Show all posts
Showing posts with label app. Show all posts

Sunday, March 11, 2012

Changing Server Report on the fly

I would like to modify some of the properties of a ServerReport entity from a desktop app using the ReportViewer control. In particular, I would like to have the document map displayed as expanded, and make some changes to the group toggle items based on the user's parameter selection.

Can someone please point me in the right direction? How do I get access programmatically to the ServerReport layout?

Thx

In the event I'm way off base just disregard this post.

Create a parameter of your choice and name it for example "ExpandDetails" and apply the Data Type as Boolean. In the default values select “Non-Queried” and type “False

Select the table in question, open up the Properties of the table, select the group that controls the expanded element, Edit the group you selected, change from the General tab to the Visibility tab, select Expression, add this code"=Iif(Parameters!ExpandDetails.Value = True, False, True)"

Select the textbox where the expanded element will occur, open up the Properties of the textbox. Change from the General tab to the Visibility tab. Select Expression at the bottom of the dialog box where you see “Expanded” and “Collapsed”, add this code “=Iif(Parameters!ExpandDetails.Value = True, True, False)”

This will create a parameter named ExpandDetails with a radio box selection. Click on the appropriate value and select “View Report

Tweak the logic to work in the manner you need. by that I mean the true or false of the IIF statements.

|||

Thanks for the reply.

I've actually tried what you suggest. My situation is that I allow my users to choose an outer group, and an inner group, with the option of choosing "None" (I.e. no inner grouping) for the inner group. I've managed to get it all working (except for the +/- icons being reversed in some cases) but I have not been able to get the Expand/Collapse to work, mainly because I have no way (that I can see) of changing a ToggleItem based on an expression.

So I need to get down and dirty with the rdl before rendering the report, and am hunting around for how to proceed. I suspect I need to dump the report using LoadReport into a memory stream and cast it somehow, but some sample code with be helpful.

Cheers,

Thursday, March 8, 2012

Changing provider from Access to SQL Server

Hello,
I have developped an app that previously used locally stored Access database on my computer and now I want to switch to SQL server on the provider's machine. However I'm not sure exactly how to do this. I didn't find any help of this sort that would help me with this. Any ideas?
Thanks a lot!
Jan

You need to change the using or imports statement from System.Data.OleDb to System.Data.SqlClient
Change all instances of OleDbConnection, OleDbCommand and OleDbDataAdapter to (respectively) SqlConnection, SqlCommand and SqlDataAdapter.
OleDb uses positional parameters, which are represented by ? characters in the SQL Strings, SqlClient uses named parameters.
Obviously, your connection string needs to be different. www.connectionstrings.com has examples, as does the MSDN documentation.
That should get you started.

|||Hi, thanks for your advice.
I think I need to specify my problem a bit better. I managed to make my ASPX pages to connect to the SQL database (instead of to Access file), but the problem is with features like membership or web-parts. Those seem to store some information in the database, however on the new server they don't seem to know how to connect to the SQL server.
I thought this is set-up in the web.config file, but eve though I do have SQL server connection strings there it doesn't work for me.
I tried adding a new provider using the VS2005 Website/Asp.Net Configuration wizzard, but I don't have the option to Add provider there :-(
Thanks a lot for any help.
Jan

Wednesday, March 7, 2012

Changing path of web service?

I have 2 report services servers one for development and one for live, I
need to add a reference to the web service in my app, but during development
it has to refernce development server, during deployment it has to reference
what ever the end user calls their server, can you change the reference url
of a web service at run time? if so how? thanks! the web services will all
have the same definition at all times. I'm also doing this in VB.NETSmokey Grindle wrote:
> I have 2 report services servers one for development and one for live, I
> need to add a reference to the web service in my app, but during development
> it has to refernce development server, during deployment it has to reference
> what ever the end user calls their server, can you change the reference url
> of a web service at run time? if so how? thanks! the web services will all
> have the same definition at all times. I'm also doing this in VB.NET
IIRC, when you declare an instance of the web service, you can set it's
URL property to the correct one.

Sunday, February 19, 2012

changing images on the fly

I am building an app to print Recipes and I need to display a different picture for each dish

The Database is Access 97 which is fine and I want to keep my images in a seperate folder on the users PC

like "C:\RecipePictures\Soup.jpg"

I have tried using an embedded, External and Database sources and cannot get any to do what I want has anybody got any ideas please

I guess I realy want to use external but it won't accept C:\RecipePictures\Soup.jpg it is looking for a URL

any help gratefully received

You need to make sure the path to your images is located under your web root. Assume your web root is c:\inetpub\wwwroot, then you need to put the RecipePictures folder in wwwroot (or a subfolder to wwwroot). Or you could create a virtual directory under wwwroot that points to C:\RecipePictures. You create a virtual directory in the IIS manager (MMC). Good luck!

|||

if the DB has the path to the image, you can have the picture in the report as expression "file://" & {the path to the imge}

that may bring the picture in.

Best solution is to do everything in SQLserver express its free! and you can have pictures in the DB

|||

thanks I will have a play with that

the problem is that my users are strictly non technical and the picures will be saved where they are saved, I have struggled to get them to save them with english names

|||

Thanks, sounds good

the access Database is a legacy thing and I may move to SqlServer but these guys are working on the road so we currently use replication through their company VPN if we added images, most are over 1meg, the syncro would be horrendous (they use 3G when they don't have wireless)

|||

OK FYI

I set the source to External

the Value to +"Fill://"+Fields!Photolocation.Value //Text field in Access DB holding the path and name of the image like C:\Recpe pictures\Soup.jpg

the MimeType was empty

this means that each record can have it's own image

|||

sorry an error should be ="File://" NOT +"Fill://"

I set the source to External
the Value to ="File://"+Fields!Photolocation.Value //Text field in Access DB holding the path and name of the image like C:\Recpe pictures\Soup.jpg
the MimeType was empty

this means that each record can have it's own image

Thursday, February 16, 2012

Changing font color dynamically in Crystal Reports

I have a windows app which uses the free version of Crystal Reports. The idea is that I should allow the users to choose their own font and colors (for example one might want to see the title green and arial). Do you happen to know how I can do that? I don't even know if it is possible given that there is practically no code behind the reports...

Thank you in advance. :)Add parameters to the report for font and font color. Right click the report field, select "format field", click the font tab and click the formula buttons next to each of the font attributes and add the code to read your parameters to make the select settings|||Can you please give me an example?|||Select {?FontColor} <--This is your parameter field
Case "Red": <-You should have a case stament for each color
crRed
Case "Black":
crBlack
Default:
DefaultAttribute

Here are the default color attributes.
crBlack
crMaroon
crGreen
crOlive
crNavy
crPurple
crTeal
crSilver
crRed
crLime
crYellow
crBlue
crFuchsia
crAqua
crWhite

Do the same for the font replacing the colors with the font names.|||But where do I write this code?|||Right click the report field, select "format field", click the font tab and click the formula buttons next to each of the font attributes and add the code to read your parameters to make the selected settings

As I originally stated above..|||try sample code as mentioned below. You can get access to any object in the report and from code, you can change the object property just like you do using visual studio. Sorry for not answering you stright. But this info will very helpful to you I recon.

Private Sub AdjustCarPicSize(ByVal iHeight As Integer, ByVal iWidth As Integer)
'For Each section As CrystalDecisions.CrystalReports.Engine.Section In reportDocument.ReportDefinition.Sections
' For Each reportObject As CrystalDecisions.CrystalReports.Engine.ReportObject In section.ReportObjects
' If reportObject.Kind = ReportObjectKind.SubreportObject Then
' Dim subReport As SubreportObject = CType(reportObject, SubreportObject)
' Dim subDocument As ReportDocument = subReport.OpenSubreport(subReport.SubreportName)
' If (subReport.SubreportName = "CarPic") Then
' For Each section1 As CrystalDecisions.CrystalReports.Engine.Section In subDocument.ReportDefinition.Sections
' For Each reportObject1 As CrystalDecisions.CrystalReports.Engine.ReportObject In section1.ReportObjects
' 'Response.Write(reportObject1.Name)
' If (reportObject1.Name = "carpicimage1") Then
' reportObject1.Height = iHeight
' reportObject1.Width = iWidth
' End If

' Next
' Next
' End If

' End If
' Next
'Next
Dim oCarPic As CrystalDecisions.CrystalReports.Engine.ReportObject = CType(reportDocument.ReportDefinition.Sections("DetailSection6").ReportObjects("Subreport1"), SubreportObject).OpenSubreport("CarPic").ReportDefinition.Sections("ReportHeaderSection2").ReportObjects("carpicimage1")

Changing field length changes AllowNulls=True

(If this is in the wrong newsgroup, let me know and I'll move it.)
Using SQLDMO from a VB app to modify an existing field in a SQL 2000
database.
All the fields in my database have AllowNulls = False.
After changing a field size in the manner below, I look at the table in
Enterprise Manager and Allow Nulls is now True! This is fully repeatable.
Here's the code:
Dim oTable As sqldmo.Table
Dim oColumn As New sqldmo.Column
'skip the Set statements..
oTable.BeginAlter
oColumn.Length = pSize
oTable.DoAlter
I do not believe the version of SQLDMO matters as this happens on older as
well as newer versions.
Any ideas?
Thanks,
Jerry
I have not used DMO objects much, but in scripting when altering a field
size, if you don't specify not null in the alter it defaults to null. So in
your DMO could maybe set the field to not null before updating it.
Thanks!
Mohit K. Gupta
B.Sc. CS, Minor Japanese
MCTS: SQL Server 2005
"Jerry J" wrote:

> (If this is in the wrong newsgroup, let me know and I'll move it.)
> Using SQLDMO from a VB app to modify an existing field in a SQL 2000
> database.
> All the fields in my database have AllowNulls = False.
> After changing a field size in the manner below, I look at the table in
> Enterprise Manager and Allow Nulls is now True! This is fully repeatable.
> Here's the code:
> Dim oTable As sqldmo.Table
> Dim oColumn As New sqldmo.Column
> 'skip the Set statements..
> oTable.BeginAlter
> oColumn.Length = pSize
> oTable.DoAlter
> I do not believe the version of SQLDMO matters as this happens on older as
> well as newer versions.
> Any ideas?
> Thanks,
> Jerry
>
>

Changing field length changes AllowNulls=True

(If this is in the wrong newsgroup, let me know and I'll move it.)
Using SQLDMO from a VB app to modify an existing field in a SQL 2000
database.
All the fields in my database have AllowNulls = False.
After changing a field size in the manner below, I look at the table in
Enterprise Manager and Allow Nulls is now True! This is fully repeatable.
Here's the code:
Dim oTable As sqldmo.Table
Dim oColumn As New sqldmo.Column
'skip the Set statements..
oTable.BeginAlter
oColumn.Length = pSize
oTable.DoAlter
I do not believe the version of SQLDMO matters as this happens on older as
well as newer versions.
Any ideas?
Thanks,
JerryI have not used DMO objects much, but in scripting when altering a field
size, if you don't specify not null in the alter it defaults to null. So in
your DMO could maybe set the field to not null before updating it.
Thanks!
--
Mohit K. Gupta
B.Sc. CS, Minor Japanese
MCTS: SQL Server 2005
"Jerry J" wrote:
> (If this is in the wrong newsgroup, let me know and I'll move it.)
> Using SQLDMO from a VB app to modify an existing field in a SQL 2000
> database.
> All the fields in my database have AllowNulls = False.
> After changing a field size in the manner below, I look at the table in
> Enterprise Manager and Allow Nulls is now True! This is fully repeatable.
> Here's the code:
> Dim oTable As sqldmo.Table
> Dim oColumn As New sqldmo.Column
> 'skip the Set statements..
> oTable.BeginAlter
> oColumn.Length = pSize
> oTable.DoAlter
> I do not believe the version of SQLDMO matters as this happens on older as
> well as newer versions.
> Any ideas?
> Thanks,
> Jerry
>
>

Changing field length changes AllowNulls=True

(If this is in the wrong newsgroup, let me know and I'll move it.)
Using SQLDMO from a VB app to modify an existing field in a SQL 2000
database.
All the fields in my database have AllowNulls = False.
After changing a field size in the manner below, I look at the table in
Enterprise Manager and Allow Nulls is now True! This is fully repeatable.
Here's the code:
Dim oTable As sqldmo.Table
Dim oColumn As New sqldmo.Column
'skip the Set statements..
oTable.BeginAlter
oColumn.Length = pSize
oTable.DoAlter
I do not believe the version of SQLDMO matters as this happens on older as
well as newer versions.
Any ideas?
Thanks,
JerryI have not used DMO objects much, but in scripting when altering a field
size, if you don't specify not null in the alter it defaults to null. So in
your DMO could maybe set the field to not null before updating it.
Thanks!
Mohit K. Gupta
B.Sc. CS, Minor Japanese
MCTS: SQL Server 2005
"Jerry J" wrote:

> (If this is in the wrong newsgroup, let me know and I'll move it.)
> Using SQLDMO from a VB app to modify an existing field in a SQL 2000
> database.
> All the fields in my database have AllowNulls = False.
> After changing a field size in the manner below, I look at the table in
> Enterprise Manager and Allow Nulls is now True! This is fully repeatable.
> Here's the code:
> Dim oTable As sqldmo.Table
> Dim oColumn As New sqldmo.Column
> 'skip the Set statements..
> oTable.BeginAlter
> oColumn.Length = pSize
> oTable.DoAlter
> I do not believe the version of SQLDMO matters as this happens on older as
> well as newer versions.
> Any ideas?
> Thanks,
> Jerry
>
>

Sunday, February 12, 2012

Changing Database Server Locale Date time settings ?

Hi There

We currently have the following scenario:

4 app servers with regional date and time settings of locale A.

1 database server with locale settings B.

What is happening is that timestamps are being generated on the app servers, these are then in a sql command which fails on the database server since the timestamp format is invalid.

It was suggested that we change the regional locale settings of the database server, but will this not have serious implications , for example every current timestamp format in the datbase will become invalid?

In a nutshell is it safe to change a database servers regional date time locale settings ? Or are there serious implications?

Thanx

As long as date/time values are stored in datetime datatypes, changing the locale/regional settings 'should' not have any impact on the data.

If ServerA uses the form of 'dd/mm/yyyy' and attempts to pass that string value to serverB (and ServerB uses the form of 'mm/dd/yyyy', there is confusion and often failure. Is '06/12/2007' June 12th, or Dec 6th?

However, if you were to make sure that any time values passed to SQL procedures and functions was in the form of 'yyyymmdd' or 'yyyy/mm/dd' (standard ISO format), there would not be a problem for one server to interpret the date from a different server.