How to Create ASP.Net Chart Control from Database using C# - c#

I am working on a web app(Asp.Net) and need to draw a chart which is using data from database.
In debug mode, I can retrieve data from database but when try to add chart
chart proporties-> dataSourceId -> SqlDataSource..
connectionstring is ok
Then I get this
The data provide 'FirebirdSql.Data.Firebird.Client' could not be found in the system configuration. unable to find the requested .NetFramework Data Provider. it may not be installed.
Why I am getting this and how to fix it?
Thanks.

This is most probably to do with the version of Firebird. Check your machine.config file for these lines:
Wrong:
<configSections>
<section name="FirebirdSql.Data.FirebirdClient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.6.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
What it should be:
<configSections>
<section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
Your machine.config file can be found at these locations (x86 or x64):
32-bit
x:\Windows\Microsoft.NET\Framework\[version]\config\machine.config
64-bit
x:\Windows\Microsoft.NET\Framework64\[version]\config\machine.config
I think you only need to edit the 32 bit version of the machine.config file as VS 2010 is 32-bit only I believe.
Try these things first and hopefully you'll find a fix!
EDIT; try reinstalling Firebird, download the latest version and uninstall all instances of Firebird from your computer beforehand
http://www.firebirdsql.org/en/net-provider/

Related

Upgrade settings from old version with different name

We use app.config to store user settings, but changed the name of the exe... for reasons. I need to be able to upgrade the settings from version 1.4 called name1.exe to version 1.5 now called name2.exe.
I've tried several methods, the first was to add code in Program.cs Main() where it would use System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath to find the path where the new settings file should go, and search the base path of that setting to find the 1.4 version under the old name, then copy the 1.4 folder into the correct part of the path where the Properties.Settings.Default.Upgrade() would work like normal.
I've also tried replacing the new app.config file with the old one and calling Properties.Settings.Default.Reload(); and doing the same but just restarting the application.
Each of those methods worked, even in release mode outside the ide. But we also use SmartAssembly to merge some other dlls into our exe's assembly. Smart assembly must do some unknown magic, because it doesn't work after being SmartAssembled.
If I manually copy the old settings to the new location (replacing the app.config) then try to run my app doens't even start, it must crash right away. Again, only after using SmartAssembly to merge our dlls. I've narrowed the crashing down to this part in the xml...
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings">
<section name="DllNameA.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="DllNameB.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="ExeName.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
That last part of the xml "section name=ExeName.Properties.Settings..."
was not there in the old settings file. I'm not sure why it's added now, but it works if I manually add it to the old settings file when copying it over.
Is there a way to make this work?
This probably isn't the right way to do this, but I did just edit the xml to add the missing section and it is working.

Unable to use Entity Framework in WCF Service on SharePoint 2013 server

We are trying to create a WCF web service which will connect to SQL Server using Entity Framework. The WCF Service will be deployed on SharePoint 2013 mapped to ISAPI folder on SharePoint hive.
We are able to deploy the solution in SharePoint 2013 server, but whenever we call the web service it returns error as below
System.IO.FileNotFoundException: Could not load file or assembly
'EntityFramework, Version=6.0.0.0, Culture=neutral,
PublicKeyToken=XXXX' or one of its dependencies. The system cannot
find the file specified.\u000d\u000a File name: 'EntityFramework,
Version=6.0.0.0, Culture=neutral, PublicKeyToken=XXXX'\u000d\u000a
at ()\u000d\u000a at \u000d\u000a\u000d\u000a"
In App.Config file we have below code.
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
...
</configSections>
<configuration>
We created a simple console application on same SharePoint 2013 server and the code ran successfully.
What are we missing here?
The problem was that the entity framework DLL needed to be present in the GAC. Despite being present in the SharePoint solution, it was not referring to it.
We added entity framework DLLs to GAC and it has now started working.

<userSettings> in app.config Could not find schema information for the element 'userSettings'

Hello when I try to add parameters to the settings table
I get multiple messages for each parameter I add.
e.g.:
Could not find schema information for
the element 'userSettings'
Could not find schema information for
the element 'setting'
Could not find schema information for
the attribute 'serializeAs'
In the app.config I get:
<project1.Properties.Settings>
<setting name="ccc" serializeAs="String">
<value>vvv</value>
</setting>
</project1.Properties.Settings>
I can use, edit and save this parameter, but the messages really annoy me.
I use the following schema (and selecting other like 20 and 30 did not help):
C:\Program Files (x86)\Microsoft Visual Studio 9.0\xml\Schemas\DotNetConfig.xsd
Any ideas?
edit:
following Hans post here is my configSections
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="project1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
I don't know what it is for and if I should change it - yet here it is :)
Thanks Asaf
Well, that doesn't look healthy. Note how it is not valid XML, the project... element is mismatched with RuthSiteManager...
Not sure how it got that way, you'll have to edit it into shape. I guess you want to rename "project1". Avoid editing the .config file by hand otherwise. And make sure you have the required <configSections> element as well.
I just had this same issue. The fix I came across was to do a 'Clean Solution' followed by a 'Rebuild Solution'. This seems to rebuild the files correctly.

Firebird Data Access Designer (DDEX) installation

hi i want to use firebird library , and i followed its instruction as below , but i get "The referenced component 'FirebirdSql.Data.Firebird' could not be found." error.
instruction :
Prerequisites
Make sure that you have Visual Studio .NET 2005 Standard or higher edition.
Express editions are not supported.
Registry update
Remember to update the path in FirebirdDDEXProviderPackageLess32.reg or FirebirdDDEXProviderPackageLess64.reg, places where to update it are marked %Path%.
Install the .reg file into the registry.
Machine.config update
Add the following two sections to machine.config (located usually at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config and C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config on 64-bit system).
<configuration>
...
<configSections>
...
<section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
...
</configSections>
...
<system.data>
<DbProviderFactories>
...
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=%Version%, Culture=%Culture%, PublicKeyToken=%PublicKeyToken%" />
...
</DbProviderFactories>
</system.data>
...
</configuration>
And subst:
%Version% With the version of the provider assembly that you have in the GAC.
%Culture% With the culture of the provider assembly that you have in the GAC.
%PublicKeyToken% With the PublicKeyToken of the provider assembly that you have in the GAC.
Did you add a reference to the assembly in your project? If not, right click in the solution explorer on references and choose add reference. Find the Firebird client assembly and add it.

How do I reference configuration information from within multiple class libraries?

I've got a bunch of DLL projects that I'm pulling into my application, each contains their own Settings.settings/app.config. When I compile the app and run for debugging, everything works just fine, but come deployment time I can't get my DLLs to read their own settings files.
I've been doing some reading and it has become apparent that there's a couple of methods to getting each dll to read its own configuration - one is to dedicate a .dll.config to the library and the other is to embed the dll's configuration in the process.exe.config.
I'm having significant issues trying to implement either and I wondered if anyone has any good docs on this - there appears to be a shortage on the Net.
I'd like a separate .dll.config for each of the libraries if possible, but in a pinch, getting each of my libraries to read their own section of the process.exe.config will do.
Can anyone point me in the right direction because I'm so close to rolling this application out but this stumbling block is causing me a significant headache.
Edit: When I merge the configuration files, I start getting TypeInitializer exceptions when I initialize objects withing my libraries. This is likely just me being retarded, but does someone have a working example of a merged config file and some basic demonstrative code for reading it from multiple assemblies?
What are the "significant issues" you encountered? I started with embedding the dll's config in the exe's config, which worked, but was cumbersome. I now have all the config stuff in one dll project. The only thing I needed to do to make that work (besides copying the settings over) was to change the Settings class to be public.
Here's an example of a merged app.config that works:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SharedConfig.Client.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- Begin copy from library app.config -->
<section name="SharedConfig.Library.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- End copy from library app.config -->
</sectionGroup>
</configSections>
<applicationSettings>
<SharedConfig.Client.Properties.Settings>
<setting name="Bar" serializeAs="String">
<value>BarFromClient</value>
</setting>
</SharedConfig.Client.Properties.Settings>
<!-- Begin copy from library app.config -->
<SharedConfig.Library.Properties.Settings>
<setting name="Bar" serializeAs="String">
<value>BarFromLibrary</value>
</setting>
</SharedConfig.Library.Properties.Settings>
<!-- End copy from library app.config -->
</applicationSettings>
</configuration>
Have each class library define configuration settings in a custom ConfigurationSection.
Then add custom section handlers to your process.exe.config file.
This MSDN article is pretty comprehensive in its explanation, with examples in both VB and C#.
See If app.config for a DLL should be in the "main config"… what do we do with WCF References in DLLs?. The real answer is "copy and paste". That's unfortunately the general solution Microsoft had in mind. In some cases, the .NET 2.0 Settings mechanism can be used, as it bakes the default values into the DLL itself. At runtime, the DLL can then save updated settings - into the .exe.config.

Categories