Wednesday, March 28, 2012
Problem in Dataset
dim ds as new MyDataset//This dataset i created while Using ADO.NET Connection
dim dset as new DataSet//This is Standard dataset
ds=SQLHelper.ExecuteDataSet(CommandType.StoredProcedure,"spr_Procedure1")
//There is no error in stored procedure
//Then i tried giving like this
dset=SQLHelper.ExecuteDataSet(CommandType.StoredProcedure,"spr_Procedure1")
ds=CType(dset,MyDataset)
//It shows the following error
System.InvalidCastException: Specified cast is not valid.
Or is there any way i can get the dataset using ADO.NET connection & stored
Procedure,If so plz send me the procedure
Thanx in advancePost your question at ADO.NET or VB.NET section to get much response
Monday, March 26, 2012
Problem in connecting 2 databases with sql Server 2005 Express
I am programming in VB6 using ADO 2.8. This connection and query works in MS access, SQL server 2000 and Sql Server 2005. does not work in Sql server 2005 express. Any Suggestions?
Connection String #1 Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;AttachDBFileName=C:\Program Files\Material_Management_System\DATA\Main.mdf;Data Source=Steve_Laptop\sqlexpress
Connection String #2 Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;AttachDBFileName=C:\Program Files\Material_Management_System\DATA\Items.mdf;Data Source=Steve_Laptop\sqlexpress
Sql Query: Select POLINE.ID as POLine_ID, PFMS.ID as Items_ID FROM POLINE LEFT JOIN Items.PFMS as PFMS ON POLINE.lItem_ID = PFMS.ID
Error: Msg 208, Level 16, State 1, Line 1
Invalid object name 'Items.PFMS'
Sql Query#2: Select POLINE.ID as POLine_ID, PFMS.ID as Items_ID FROM POLINE LEFT JOIN Items.dbo.PFMS as PFMS ON POLINE.lItem_ID = PFMS.ID
Error: Msg 208, Level 16, State 1, Line 1
Invalid object name 'Items.dbo.PFMS'.
I am running the queries directly from the 2005 Mgt window to take as many variables out of the equasion. I get the same error in Visual basic
How am I supposed to reference a join of 2 databases? Any suggestions
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
Wednesday, March 21, 2012
Problem getting contacts from Exchange
When I attempt to use ADO to get data from any "Contacts" folder I always get...
System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="System.Data"
StackTrace:
at System.Data.Common.UnsafeNativeMethods.ICommandText.Execute(IntPtr pUnkOuter, Guid& riid, tagDBPARAMS pDBParams, IntPtr& pcRowsAffected, Object& ppRowset)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at WinAppExchange.Form1.button1_Click(Object sender, EventArgs e) in C:\Projects\CodeReviewHelper\WinAppExchange\WinAppExchange\Form1.cs:line 31
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WinAppExchange.Program.Main() in C:\Projects\CodeReviewHelper\WinAppExchange\WinAppExchange\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
string connect = @."Provider=Microsoft.Jet.OLEDB.4.0;Exchange 4.0;MAPILEVEL=Public Folders|All Public\Our Contact List;DATABASE=C:\\Temp\\;";
OleDbConnection connection = new OleDbConnection(connect);
connection.Open();
OleDbCommand command = new OleDbCommand("Select * from [Staff]",connection);
using (OleDbDataReader dataReader = command.ExecuteReader(CommandBehavior.CloseConnection)) // EXCEPTION HERE
{
while (dataReader.Read())
{
System.Diagnostics.Debug.WriteLine(dataReader[0]);
}
}
I've tried the same code against my local stores and I get the same result. However, it works fine for every other folder type, Tasks, notes, inbox, etc. Any ideas?
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=168193&SiteID=1
HTH
Friday, March 9, 2012
Problem deploying data processing extension
provider so that it works with reporting services. That is, it works in the
designer, but when I try to deploy the application, I run into a little
problem.
It loads my wrapper (the actual extension) just fine, but then the log
reports a failure to load the dependency dll. (The ADO.NET provider that my
wrapper extends.)
I'm sure what I need to do is somehow setup the rssrvpolicy.config file so
that it provides correct permissions to both my wrapper and the dependency,
but I cannot find ANY documentation that explains how to do this sort of
thing.
Here is the relevant portion of my config file:
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="FusionWareCodeGroup"
Description="Code group for FusionWare Direct Reporting Services Provider">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
ervices\ReportServer\bin\FusionWare.DirectADO.ReportingServicesProvider2005.dll"
/>
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
Services\ReportServer\bin\FusionWare.DirectADO.dll" />
</CodeGroup>
</PolicyLevel>
</policy>
</security>
</mscorlib>
</configuration>
Note that I've tried to tell it about the second dependency but this is not
working and may, in fact be invalid. I've tried every imaginable
combination to get this going, including multiple CodeGroup elements, but I
still get the following error every time:
aspnet_wp!library!1!2/6/2006-15:34:51:: i INFO: Call to RenderFirst(
'/Report Project1/Report1' )
aspnet_wp!extensionfactory!1!2/6/2006-15:34:52:: e ERROR: Exception caught
instantiating FusionWare report server extension:
System.IO.FileLoadException: Could not load file or assembly
'FusionWare.DirectADO, Version=5.0.61.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. Failed to grant minimum
permission requests. (Exception from HRESULT: 0x80131417)
File name: 'FusionWare.DirectADO, Version=5.0.61.0, Culture=neutral,
PublicKeyToken=null' --> System.Security.Policy.PolicyException: Required
permissions cannot be acquired.
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
PermissionSet& denied, Boolean checkExecutionPermission)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
PermissionSet& denied, Int32& securitySpecialFlags, Boolean
checkExecutionPermission)
at System.Reflection.Assembly.GetType(String name, Boolean throwOnError,
Boolean ignoreCase)
at
Microsoft.ReportingServices.Diagnostics.ExtensionClassFactory.CreateExtensionObject(Extension
extConfig)
.
aspnet_wp!processing!1!2/6/2006-15:34:52:: e ERROR: The connection object of
the data source type FusionWare does not implement any of the required
interfaces.
aspnet_wp!library!1!2/6/2006-15:34:52:: e ERROR: Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
An attempt has been made to use a data extension 'FusionWare' that is not
registered for this report server., ;
Info:
Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
An attempt has been made to use a data extension 'FusionWare' that is not
registered for this report server.
aspnet_wp!processing!1!2/6/2006-15:35:03:: e ERROR: Data source
'DataSource1': An error has occurred. Details:
Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
An attempt has been made to use a data extension 'FusionWare' that is not
registered for this report server.
at
Microsoft.ReportingServices.DataExtensions.ReportDataSource.CreateConnection()
at
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode.OpenConnection(DataSource
dataSourceObj, ReportProcessingContext pc)
at
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode.Process()
aspnet_wp!processing!1!2/6/2006-15:35:03:: e ERROR: An exception has
occurred in data source 'DataSource1'. Details:
Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
An attempt has been made to use a data extension 'FusionWare' that is not
registered for this report server.
at
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode.Process()
at
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeDataSourceNode.ProcessConcurrent(Object
threadSet)
aspnet_wp!processing!1!2/6/2006-15:35:03:: i INFO: Merge abort handler
called for ID=-1. Aborting data sources ...
aspnet_wp!processing!1!2/6/2006-15:35:03:: e ERROR: Throwing
Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An
error has occurred during report processing., ;
Info:
Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An
error has occurred during report processing. -->
Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
An attempt has been made to use a data extension 'FusionWare' that is not
registered for this report server.
at
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode.Process()
at
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeDataSourceNode.ProcessConcurrent(Object
threadSet)
-- End of inner exception stack trace --
aspnet_wp!library!5!2/6/2006-15:44:46:: i INFO: Cleaned 0 batch records, 0
policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running
jobs, 0 persisted streams
Any help would be appreciated!I hate it when I find a question that matches something I'm looking for but
don't see a response, so I'll post my own response:
First a better explanation of the problem:
I have a DPE that extends another dll (an ADO.NET provider).
Designer always worked, but CAS under SSRS would not load the underlying dll
due to permissions. Here is what I had to do to fix it:
First, I had to change the underlying assembly (not the DPE itself) to
Assert FullTrust rights and the right to run for a PartiallyTrusted caller:
In the underlying dll's AssemblyInfo.cs file I added this line:
[assembly: System.Security.AllowPartiallyTrustedCallers()]
Then, for any class that would get called at run-time I added the following
at the top:
using System.Security.Permissions;
and decorated the class itself with this line:
[PermissionSetAttribute(SecurityAction.Assert, Name="FullTrust")]
Then, I had to modify the rssrvpolicy.config file. The tricky part here is
that there are two levels of CodeGroup elements.
There is a top level CodeGroup element that contains a bunch of CodeGroup
elements inside it. The top level default one says that anything you run
into has no permissions. Then inside it, you define exceptions - things
that are allowed to run with various permissions. I had to add a CodeGroup
element that granted my *underlying* dll FullTrust. It looked like this:
</NamedPermissionSets>
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="Nothing">
<IMembershipCondition
class="AllMembershipCondition"
version="1"
/>
<!-- Added by RHOU -->
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="FusionWareBaseCodeGroup"
Description="Code group for FusionWare Direct ADO.NET Provider">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
Services\ReportServer\bin\FusionWare.DirectADO.dll" />
</CodeGroup>
The normal entry, as documented, for my DPE had to be a new, top-level
CodeGroup element. In otherwords, unlike the one I added above, it was a
sibling of the top-level CodeGroup element, not a child of it. It looked
like this, btw:
</CodeGroup>
</CodeGroup>
</CodeGroup>
<!-- Added by RHOU -->
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="FusionWareCodeGroup"
Description="Code group for FusionWare Direct Reporting
Services Provider">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
Services\ReportServer\bin\FusionWare.DirectADO.ReportingServicesProvider2005.dll"
/>
</CodeGroup>
This combination worked both in SSRS 2005 and the equivalent in SSRS 2000.
I find it interesting that a non DPE had to be defined as part of the
default CodeGroup (nested in it), while the DPE had to be defined separately
from the default CodeGroup. If I moved either CodeGroup element to where
the other was the whole house of cards fell down.
I find that information about how CAS works is really hard to find,
incomplete and contradictory. I also find the complete lack of diagnostic
tools to let me see what permissions were requested, allowed/denied, when
and by whom, is a huge deficit. This is far too important to be left in
this "WAG" condition! Just my thoughts...
FWIW, it worked for me!
"Raoul James" <raoulj456@.hotmail.com> wrote in message
news:OdneBe3KGHA.720@.TK2MSFTNGP14.phx.gbl...
>I have developed a data processing extension that extends an ADO.NET
>provider so that it works with reporting services. That is, it works in
>the designer, but when I try to deploy the application, I run into a little
>problem.
> It loads my wrapper (the actual extension) just fine, but then the log
> reports a failure to load the dependency dll. (The ADO.NET provider that
> my wrapper extends.)
> I'm sure what I need to do is somehow setup the rssrvpolicy.config file so
> that it provides correct permissions to both my wrapper and the
> dependency, but I cannot find ANY documentation that explains how to do
> this sort of thing.
> Here is the relevant portion of my config file:
> <CodeGroup class="UnionCodeGroup"
> version="1"
> PermissionSetName="FullTrust"
> Name="FusionWareCodeGroup"
> Description="Code group for FusionWare Direct Reporting Services
> Provider">
> <IMembershipCondition class="UrlMembershipCondition"
> version="1"
> Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
> ervices\ReportServer\bin\FusionWare.DirectADO.ReportingServicesProvider2005.dll"
> />
> <IMembershipCondition class="UrlMembershipCondition"
> version="1"
> Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
> Services\ReportServer\bin\FusionWare.DirectADO.dll" />
> </CodeGroup>
> </PolicyLevel>
> </policy>
> </security>
> </mscorlib>
> </configuration>
> Note that I've tried to tell it about the second dependency but this is
> not working and may, in fact be invalid. I've tried every imaginable
> combination to get this going, including multiple CodeGroup elements, but
> I still get the following error every time:
> aspnet_wp!library!1!2/6/2006-15:34:51:: i INFO: Call to RenderFirst(
> '/Report Project1/Report1' )
> aspnet_wp!extensionfactory!1!2/6/2006-15:34:52:: e ERROR: Exception caught
> instantiating FusionWare report server extension:
> System.IO.FileLoadException: Could not load file or assembly
> 'FusionWare.DirectADO, Version=5.0.61.0, Culture=neutral,
> PublicKeyToken=null' or one of its dependencies. Failed to grant minimum
> permission requests. (Exception from HRESULT: 0x80131417)
> File name: 'FusionWare.DirectADO, Version=5.0.61.0, Culture=neutral,
> PublicKeyToken=null' --> System.Security.Policy.PolicyException: Required
> permissions cannot be acquired.
> at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
> PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
> PermissionSet& denied, Boolean checkExecutionPermission)
> at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
> PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
> PermissionSet& denied, Int32& securitySpecialFlags, Boolean
> checkExecutionPermission)
> at System.Reflection.Assembly.GetType(String name, Boolean throwOnError,
> Boolean ignoreCase)
> at
> Microsoft.ReportingServices.Diagnostics.ExtensionClassFactory.CreateExtensionObject(Extension
> extConfig)
> .
> aspnet_wp!processing!1!2/6/2006-15:34:52:: e ERROR: The connection object
> of the data source type FusionWare does not implement any of the required
> interfaces.
> aspnet_wp!library!1!2/6/2006-15:34:52:: e ERROR: Throwing
> Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
> An attempt has been made to use a data extension 'FusionWare' that is not
> registered for this report server., ;
> Info:
> Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
> An attempt has been made to use a data extension 'FusionWare' that is not
> registered for this report server.
> aspnet_wp!processing!1!2/6/2006-15:35:03:: e ERROR: Data source
> 'DataSource1': An error has occurred. Details:
> Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
> An attempt has been made to use a data extension 'FusionWare' that is not
> registered for this report server.
> at
> Microsoft.ReportingServices.DataExtensions.ReportDataSource.CreateConnection()
> at
> Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode.OpenConnection(DataSource
> dataSourceObj, ReportProcessingContext pc)
> at
> Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode.Process()
> aspnet_wp!processing!1!2/6/2006-15:35:03:: e ERROR: An exception has
> occurred in data source 'DataSource1'. Details:
> Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
> An attempt has been made to use a data extension 'FusionWare' that is not
> registered for this report server.
> at
> Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode.Process()
> at
> Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeDataSourceNode.ProcessConcurrent(Object
> threadSet)
> aspnet_wp!processing!1!2/6/2006-15:35:03:: i INFO: Merge abort handler
> called for ID=-1. Aborting data sources ...
> aspnet_wp!processing!1!2/6/2006-15:35:03:: e ERROR: Throwing
> Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException:
> An error has occurred during report processing., ;
> Info:
> Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException:
> An error has occurred during report processing. -->
> Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException:
> An attempt has been made to use a data extension 'FusionWare' that is not
> registered for this report server.
> at
> Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode.Process()
> at
> Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeDataSourceNode.ProcessConcurrent(Object
> threadSet)
> -- End of inner exception stack trace --
> aspnet_wp!library!5!2/6/2006-15:44:46:: i INFO: Cleaned 0 batch records, 0
> policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running
> jobs, 0 persisted streams
> Any help would be appreciated!
>
>