Showing posts with label property. Show all posts
Showing posts with label property. Show all posts

Saturday, February 25, 2012

Data Access Error - ConnectionString property

Hi guys,

I'm getting this error:

System.InvalidOperationException: The ConnectionString property has not been initialized

when I'm trying to connect to an SQL database using the following code:

Dim mySelectQuery As String = "SELECT [tabl_id] FROM [myTable]"
Dim myConnection As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("myConnString"))
Dim myCommand As New SqlCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As SqlDataReader
myReader = myCommand.ExecuteReader()
While myReader.Read()
Response.Write(myReader("tabl_id") & "<br/>")
End While
myConnection.Close()

and in web.config:

<appSettings/>
<connectionStrings>
<add name="myConnString" connectionString="Data Source=100.100.100.100;Initial Catalog=myDatabase;User ID=me;Password=password" providerName="System.Data.SqlClient"/>
</connectionStrings>

If I place the actual connection string inside instead of trying to reference the web.config setting it works, but using 'System.Configuration.ConfigurationManager.AppSettings' returns the error. Is there something I'm doing wrong?

Ferox:

Dim myConnection As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("myConnString"))
and in web.config:

<appSettings/>
<connectionStrings>
<add name="myConnString" connectionString="Data Source=100.100.100.100;Initial Catalog=myDatabase;User ID=me;Password=password" providerName="System.Data.SqlClient"/>
</connectionStrings>

hi there,

the connection stirng element in your webconfig is actually not a child node of the appSettings but its on the same level instead. So maybe you wanna get the ConnectionStrings node instead of the AppSettings node out of the web.config.

System.Configuration.ConfigurationManager.ConnectionStrings("myConnString").ConnectionString

see if the above line works.

|||

Thanks a lot, that works perfectly! :)

Tuesday, February 14, 2012

Cutomizing Exported Excel tabs

Hi All
I have a very simple report that is grouped on a particular field. I have
also set the "Page Break at end property" set to true for this group. I wish
to set up a subscription that will email this report as an excel attachment.
The excel export shows the records of each group in a separate sheet -
Exactly the way I need. What I also want is that the tabs of each sheet
should show the group field name as its name instead of sheet1, sheet2
etc....
Is there any way to achieve this ?
ThanksSorry, there is no property in the RDL that would allow you to achieve
customizing the sheet names.
It is under consideration for inclusion in a future release.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"PR" <PR@.discussions.microsoft.com> wrote in message
news:FEDD440A-49E9-4F2F-9DA3-08CC995E2D7B@.microsoft.com...
> Hi All
> I have a very simple report that is grouped on a particular field. I have
> also set the "Page Break at end property" set to true for this group. I
wish
> to set up a subscription that will email this report as an excel
attachment.
> The excel export shows the records of each group in a separate sheet -
> Exactly the way I need. What I also want is that the tabs of each sheet
> should show the group field name as its name instead of sheet1, sheet2
> etc....
> Is there any way to achieve this ?
> Thanks|||Robert
Can it be moved off the consideration list onto the must do list?
Providing the functionality to output to multiple sheets without the ability
to dynamically name those sheets makes multiple sheets pretty pointless.
I have one report that generates an Excel file for state managers. The file
contains a seperate sheet for each consultant in their state. As I can't
name the sheets from RS all they see is Sheet1, Sheet2, etc...
One of these files has over 200 sheets and the generic naming is a major
pain in the butt. Due to this problem most of the managers won't sign-off on
the costs for developing/deploying RS at our site.
Thanks
Phill
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:OA99z8MBFHA.3924@.TK2MSFTNGP10.phx.gbl...
> Sorry, there is no property in the RDL that would allow you to achieve
> customizing the sheet names.
> It is under consideration for inclusion in a future release.
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> "PR" <PR@.discussions.microsoft.com> wrote in message
> news:FEDD440A-49E9-4F2F-9DA3-08CC995E2D7B@.microsoft.com...
>> Hi All
>> I have a very simple report that is grouped on a particular field. I have
>> also set the "Page Break at end property" set to true for this group. I
> wish
>> to set up a subscription that will email this report as an excel
> attachment.
>> The excel export shows the records of each group in a separate sheet -
>> Exactly the way I need. What I also want is that the tabs of each sheet
>> should show the group field name as its name instead of sheet1, sheet2
>> etc....
>> Is there any way to achieve this ?
>> Thanks
>
>|||I use the document map facility to get aroung this. It exports as the front
sheet of the excel file and clicking on each title takes you to the correct
sheet.
"news.microsoft.com" <pcarter_NOT_AT_SPAM_bellpotter.com.au> wrote in
message news:ueUeHQPBFHA.2624@.TK2MSFTNGP11.phx.gbl...
> Robert
> Can it be moved off the consideration list onto the must do list?
> Providing the functionality to output to multiple sheets without the
> ability to dynamically name those sheets makes multiple sheets pretty
> pointless.
> I have one report that generates an Excel file for state managers. The
> file contains a seperate sheet for each consultant in their state. As I
> can't name the sheets from RS all they see is Sheet1, Sheet2, etc...
> One of these files has over 200 sheets and the generic naming is a major
> pain in the butt. Due to this problem most of the managers won't sign-off
> on the costs for developing/deploying RS at our site.
> Thanks
> Phill
>
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> news:OA99z8MBFHA.3924@.TK2MSFTNGP10.phx.gbl...
>> Sorry, there is no property in the RDL that would allow you to achieve
>> customizing the sheet names.
>> It is under consideration for inclusion in a future release.
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "PR" <PR@.discussions.microsoft.com> wrote in message
>> news:FEDD440A-49E9-4F2F-9DA3-08CC995E2D7B@.microsoft.com...
>> Hi All
>> I have a very simple report that is grouped on a particular field. I
>> have
>> also set the "Page Break at end property" set to true for this group. I
>> wish
>> to set up a subscription that will email this report as an excel
>> attachment.
>> The excel export shows the records of each group in a separate sheet -
>> Exactly the way I need. What I also want is that the tabs of each sheet
>> should show the group field name as its name instead of sheet1, sheet2
>> etc....
>> Is there any way to achieve this ?
>> Thanks
>>
>|||I agree with you Phill... my company likes seamless transitions. Reporting
Services would've been the easiest solution if we had control on the
sheetnames.
I'm keeping my fingers crossed that this is included in the SP2 that's going
to be realeased soon (mid-April last I read). I cannot see the funcitonal
enhancements list because it is in the beta site which I don't have access
to.
Pete
"news.microsoft.com" wrote:
> Robert
> Can it be moved off the consideration list onto the must do list?
> Providing the functionality to output to multiple sheets without the ability
> to dynamically name those sheets makes multiple sheets pretty pointless.
> I have one report that generates an Excel file for state managers. The file
> contains a seperate sheet for each consultant in their state. As I can't
> name the sheets from RS all they see is Sheet1, Sheet2, etc...
> One of these files has over 200 sheets and the generic naming is a major
> pain in the butt. Due to this problem most of the managers won't sign-off on
> the costs for developing/deploying RS at our site.
> Thanks
> Phill
>
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> news:OA99z8MBFHA.3924@.TK2MSFTNGP10.phx.gbl...
> > Sorry, there is no property in the RDL that would allow you to achieve
> > customizing the sheet names.
> > It is under consideration for inclusion in a future release.
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> >
> >
> > "PR" <PR@.discussions.microsoft.com> wrote in message
> > news:FEDD440A-49E9-4F2F-9DA3-08CC995E2D7B@.microsoft.com...
> >> Hi All
> >>
> >> I have a very simple report that is grouped on a particular field. I have
> >> also set the "Page Break at end property" set to true for this group. I
> > wish
> >> to set up a subscription that will email this report as an excel
> > attachment.
> >> The excel export shows the records of each group in a separate sheet -
> >> Exactly the way I need. What I also want is that the tabs of each sheet
> >> should show the group field name as its name instead of sheet1, sheet2
> >> etc....
> >>
> >> Is there any way to achieve this ?
> >>
> >> Thanks
> >
> >
> >
>
>