I am creating a new sheet in Smartsheet via the API in Visual Studio 2015 C#.
I have followed the code/API Guide from Smartsheet but i get an error at run time when the code fires.
The error is as follows:
Smartsheet.Api.ResourceNotFoundException was unhandled
HResult=-2146233088
Message=Not Found
Source=smartsheet-csharp-sdk
StackTrace:
at Smartsheet.Api.Internal.AbstractResources.HandleError(HttpResponse response)
at Smartsheet.Api.Internal.AbstractResources.CreateResource[T](String path, Type objectClass, T object)
at Smartsheet.Api.Internal.FolderSheetResourcesImpl.CreateSheet(Int64 folderId, Sheet sheet)
at Aviva_Order_Systems.avivaorders.button1_Click(Object sender, EventArgs e) in C:\Dropbox\AL DB\Dropbox\Aviva\Order Project\Aviva Order Systems\avivaorders.cs:line 372
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(IntPtr 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 Aviva_Order_Systems.Program.Main() in C:\Dropbox\AL DB\Dropbox\Aviva\Order Project\Aviva Order Systems\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
"
This section of the code is what is being highlight when i attempt to debug the error.
Sheet newSheet = ssproj.FolderResources.SheetResources.CreateSheet(
#####, // long folderId
new Sheet
{
Name = "OrderProfile",
Columns = new Column[] { CCnum, CCName, Project, Supplier, SEQ }
}
);
Note i have changed the #### on purpose. It is giving the error here:
Sheet newSheet = ssproj.FolderResources.SheetResources.CreateSheet(
#####, // long folderId
new Sheet
{
Name = "OrderProfile",
Columns = new Column[] { CCnum, CCName, Project, Supplier, SEQ }
}
);
Any ideas on what is causing this? I have tried searching
Looks like you're trying to create the sheet in the specified folder. Based on the error you're getting, I'd suspect that the folder ID that you're specifying isn't valid.
To troubleshoot, you can verify whether the folder ID is valid by trying to execute a Get Folder request with that ID. If the ID is valid, the Get Folder request will succeed; if it's invalid, the request will fail. The following C# code example attempts to retrieve folder with ID = 7116448184199044.
Folder folder = smartsheet.FolderResources.GetFolder(
7116448184199044, // long folderId
null // IEnumerable<FolderInclusion> include
);
UPDATE (in response to your comment)
If you want to create the sheet in a folder and that folder happens to be located within a shared workspace, the API call you're using (Create Sheet in Folder) should work. If you're getting the "resource not found" error in response to this API request, then either the folder ID you're specifying is invalid OR the account that owns the API access token you're using to issue the API request doesn't have access to that folder/workspace. As described previously, you can verify that the folder ID is valid (and that the account that owns the API access token does have access to the folder) by confirming that you're able to successfully issue a Get Folder API request for that folder.
If you want to create the sheet at the root of the shared workspace (i.e., not inside a folder, but rather, at the root level of the workspace), you'll need to use the Create Sheet in Workspace API request to do so (specifying the ID of the workspace). The account that owns the API access token used to issue the API request must have access to the workspace in order for this call to succeed.
Related
I am facing this weird issue when i attempt to create a new bitmap image to pass into a method.
The exception happens when at
bitmap bm = new bitmap("images/cat.jpg");
I have tried using various images of all sizes to try and test if it is the file size problem, however turns out only 1 existing image in the project can work(which is a picture of a cat).
All other images return the error "Parameter is invalid".. I am tried rebuilding the project and allowing read permissions, but i still can't get it to work.
System.ArgumentException was unhandled
HResult=-2147024809
Message=Parameter is not valid.
Source=System.Drawing
StackTrace:
at System.Drawing.Bitmap..ctor(String filename)
at Image_Authentication_Final.RegistrationForm.btnRegister_Click(Object sender, EventArgs e) in c:\Users\Acc\Desktop\Image Authentication Final\Image Authentication Final\RegistrationForm.cs:line 176
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 MetroFramework.Controls.MetroButton.OnMouseUp(MouseEventArgs e)
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(IntPtr 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 Image_Authentication_Final.Program.Main() in c:\Users\Acc\Desktop\Image Authentication Final\Image Authentication Final\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Try a fully qualified path to the image file with double backslashes ("C:\test\abc.jpg")
Determine if the jpeg file is valid for .net's image codec
Create jpeg in MS Paint
Create jpeg in Gimp, Photoshop, ...
Use imagemagick to convert the jpeg from jpeg to png and then back to jpeg
Use jpegtran to optimize the jpeg to force rewriting of the jpeg header
Use imagemagick's identify or gimp to determine what is in the jpeg (it could be a different image file format or jpeg 2000)
In .net code, use File or FileInfo calls to verify that the file exists, has non-zero length and is acessible
If the file is on a network drive and has just been written, it may take a second or two for the file to be released from exclusive use even after the file has been closed by the creator of the file.
Forgot to add. .NET is notoriously odd at handling bitmaps and images and needs image resources to be freed up or disposed. Repeatedly doing image operations without freeing them will cause issues.
Check the handles count of the process in process explorer.
For server-side or even desktop applications for image processing, I've written the image to disk, then ran imagemagick.exe command line to process the image and waited for the image file output to be written. It allows imagemagick to start, do image operation, and exit all in one process without clogging up .net's memory or handles.
I am currently working on a project in which I need to use FP-Growth algorithm. I know Weka is a handy tool for it. However, I am using C# for coding (due to some other libraries I need). So, I converted weka.jar to weka.dll using IKVM.NET. Below is a code snippet that i have written:
FPGrowth FPMiner = new FPGrowth();
FPMiner.buildAssociations(dataset);
AssociationRules rules = FPMiner.getAssociationRules();
List<AssociationRule> rule = rules.getRules();
This gives me an error as:
Cannot implicitly convert type 'java.util.List' to
'System.Collections.Generic.List'.
An explicit conversion exists (are you missing a cast?)
So, I added a cast to the last line as:
List<AssociationRule> rule = (System.Collections.Generic.List<AssociationRule>)rules.getRules();
The error goes away but I get an exception when I run my code, saying:
System.InvalidCastException was unhandled Message=Unable to cast
object of type 'java.util.ArrayList' to type
System.Collections.Generic.List`1[weka.associations.AssociationRule]'.
Source=WindowsFormsApplication1
The stacktrace goes as:
StackTrace:
at DetectGroup.Form1.GenerateARFF() in C:\Users\user\Documents\Visual Studio 2010\Projects\DetectGroup\DetectGroup\Form1.cs:line 279
at DetectGroup.Form1.findNearestNeighbours() in C:\Users\user\Documents\Visual Studio 2010\Projects\DetectGroup\DetectGroup\Form1.cs:line 236
at DetectGroup.Form1.findSelectedTraj() in C:\Users\user\Documents\Visual Studio 2010\Projects\DetectGroup\DetectGroup\Form1.cs:line 165
at DetectGroup.Form1.button2_Click(Object sender, EventArgs e) in C:\Users\user\Documents\Visual Studio 2010\Projects\DetectGroup\DetectGroup\Form1.cs:line 404
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.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(IntPtr 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 DetectGroup.Program.Main() in C:\Users\user\Documents\Visual Studio 2010\Projects\DetectGroup\DetectGroup\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart() InnerException:
I am unable to figure out what to do now. I have tried searching stuff but haven't yet got the solution. I understand that the error is because getRules() returns java.util.List while I am trying to use it as System.Collections.Generic.List. What can I do to avoid it? Any help would be great!
Also, is there any data mining library (like Weka) available in C#?
Thank you!
I am answering my own question. I used this link to solve the problem I was facing. Thanks #SecretSquirrel(see the comments) and #Jon Iles (see the answer I've linked).
This is my first attempt trying to access db files from the server. If run the program locally there are no problems
I stored ms access files on the server and I trying to run the program from my laptop and I am recieving the following error....
System.Data.OleDb.OleDbException was unhandled is not a valid path. Make sure that the path
name is spelled correctly and that you are connected to the server on which the file resides.
My connection string looks something like this...
myCon = new OleDbConnection(#"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\name-SERVER\SHAREDFILES\FileRDB.mdb; Jet OLEDB:System Database=system.mdw");
There has username and password for the server. Should I include this in the connection string?
Stacktrace looks like this...
System.Data.OleDb.OleDbException was unhandled
is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
Source=Microsoft JET Database Engine
ErrorCode=-2147467259
StackTrace:
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at MALHRManagementSystem.FrmLogin.btnLogin_Click(Object sender, EventArgs e) in C:\Users\username\Desktop\Project\foldername\foldername\foldername\Form.cs:line 40
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(IntPtr 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 somefilename.Program.Main() in C:\Users\username\Desktop\Project\foldername\foldername\foldername\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Please can someone advise me how do I correct this problem.
Thanks in advance
I am not sure what tag I should use for this thread but please correct it if I am wrong here.
db is MS-Access 2003 and visual studio 2010
This is working now. To have a mapped network drive on vista/ Windows 7. Right click on My Computer > Map Network Drive > Select a drive > Click on Browse button . A menu appears as Browse For Folder -- Select a shared network folder. Then choose the network name and the folder. Once you have done that Click OK. That is all you have to do. Here are some useful links on howto if anyone is interested...
here
here
Vista
I am doing college project. In that, they want a bonafide certificate. For that, I planned to pass TextBox string to report.
I googled for passing parameter in a winform. Then I got this step by step process. I implement that.
Step:
1: In Visual Studio 2010, open your
.rdlc file, and open “Report Data”
window (If you can not see this
window, go to View menu to open it);
2: Right click the “Parameters” node,
and add a new Parameter, ie: named it
“content“;
3: In your .rdlc file, add a textbox,
named it tbContent, and set its filed
express to :
=Parameters!content.Value
4: Go to your Form file which include
your reporterview control, and add the
following code:
this.reportViewer1.LocalReport.ReportEmbeddedResource
= “TestReport.Report1.rdlc”;
ReportParameter rp = new ReportParameter(“content”,
this.textBox1.Text);
this.reportViewer1.LocalReport.SetParameters(new
ReportParameter[] { rp });
this.reportViewer1.RefreshReport();
5: then you can pass the parameter
from the TextBox on the form to .rdlc
file;
I added using Microsoft.Reporting.WinForms; assembly reference.
this.reportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc";
ReportParameter rp = new ReportParameter("content", this.textBox1.Text);
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
this.reportViewer1.RefreshReport();
But it throws the exception:
Local processing Exception was
unhandled at
this.reportViewer1.LocalReport.SetParameters(new
ReportParameter[] { rp });
line.
Here's the full error from the clipboard:
Microsoft.Reporting.WinForms.LocalProcessingException was unhandled
Message=An error occurred during local report processing.
Source=Microsoft.ReportViewer.WinForms
StackTrace:
at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
at Microsoft.Reporting.WinForms.LocalReport.SetParameters(IEnumerable`1 parameters)
at Report.Form1.Form1_Load(Object sender, EventArgs e) in D:\Jagadeeswaran\Project\Report\Report\Form1.cs:line 38
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.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.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
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 Report.Program.Main() in D:\Jagadeeswaran\Project\Report\Report\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ApplicationException
Message=The report definition for report 'D:\Jagadeeswaran\Project\Report\Report\bin\Debug\~/Report1.rdlc' has not been specified
Source=Microsoft.ReportViewer.Common
StackTrace:
at Microsoft.Reporting.PreviewStore.GetCompiledReport(CatalogItemContextBase context, Boolean rebuild, Byte[]& reportDefinition, ControlSnapshot& snapshot)
at Microsoft.Reporting.LocalService.GetCompiledReport(CatalogItemContextBase itemContext, Boolean rebuild, ControlSnapshot& snapshot)
at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
InnerException: System.IO.DirectoryNotFoundException
Message=Could not find a part of the path 'D:\Jagadeeswaran\Project\Report\Report\bin\Debug\~\Report1.rdlc'.
Source=mscorlib
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Microsoft.ReportingServices.StandalonePreviewStore.GetReportDefinition(ReportID reportId)
at Microsoft.Reporting.PreviewStore.GetCompiledReport(CatalogItemContextBase context, Boolean rebuild, Byte[]& reportDefinition, ControlSnapshot& snapshot)
InnerException:
Set this:
this.reportViewer1.ProcessingMode =
Microsoft.Reporting.WinForms.ProcessingMode.Local;
And change this:
this.reportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc"
to
this.reportViewer1.LocalReport.ReportPath = "Report1.rdlc";
Just in case that this would be the case, I had the same problem after I reorganized my project folders, thus changing the report file path. All I had to do is re-selecting the report in the ReportViewer's Choose Report ComboBox accessible from its upper-right corner.
also double check that you are spelling your rdlc filename correctly. For example, my report file was ReportName.rdlc but I had typed in this.reportViewer1.LocalReport.ReportPath = "ReportsName.rdlc";
You can use embedded just fine, just don't forget to include the name space in the RDLC path. The assembly namespace is required, as well as any possible sub namespaces you might have as the full namespace path to the report.
reportViewer1.LocalReport.ReportEmbeddedResource = "assemblyname.Report1.rdlc"
or
reportViewer1.LocalReport.ReportEmbeddedResource = "assemblyname.subnamespace.Report1.rdlc"
I have just run Install-Package Microsoft.SqlServer.Types in "NuGet Package Manager Console" and everything is working well.
if (webBrowser1.DocumentText.IndexOf("Page: 1") != -1)
on the above line i am getting this exception
System.IO.FileNotFoundException was
unhandled Message="The system cannot
find the file specified. (Exception
from HRESULT: 0x80070002)"
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.UnsafeNativeMethods.IPersistStreamInit.Save(IStream
pstm, Boolean fClearDirty)
at System.Windows.Forms.WebBrowser.get_DocumentStream()
at System.Windows.Forms.WebBrowser.get_DocumentText()
at WindowsFormsApplication1.Form1.GenerateETGWorklists()
in C:\Documents and
Settings\agordon\My Documents\Visual
Studio
2008\Projects\GenerateWorklists\GenerateWorklists\Form1.cs:line
603
at WindowsFormsApplication1.Form1.btnProcess_Click(Object
sender, EventArgs e) in C:\Documents
and Settings\agordon\My
Documents\Visual Studio
2008\Projects\GenerateWorklists\GenerateWorklists\Form1.cs:line
55
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 WindowsFormsApplication1.Program.Main()
in C:\Documents and
Settings\agordon\My Documents\Visual
Studio
2008\Projects\GenerateWorklists\GenerateWorklists\Program.cs:line
18
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()
InnerException:
what is the meaning of this? i did not get this error yesterday and getting it today. the webpage opens no problem and the text Page: 1 is definitely there.
here is a similar issue also without solution
http://bytes.com/topic/c-sharp/answers/657812-webbrowser-documenttext-getting-problem
this is a known bug and microsoft doesn't do anything about it for vs2008 at least. here's a fix:
String lastsource = ((mshtml.HTMLDocumentClass)(((webBrowser1.Document.DomDocument)))).documentElement.innerHTML;
webBrowser1.Document.OpenNew(true);
webBrowser1.Document.Write(lastsource);
now we can access DocumentText with no problems
dont forget to import mshtml as a reference
Try webBrowser1.Document.Body.InnerText.
I too found it strange that the web browser control was throwing an exception related to file access, when I was loading a page from the web.
When looking into this, I noticed something strange:
This error is far less common when the temporary internet files have recently been cleared.
I modified my application so that it clears the temporary internet files automatically when the application starts, which was enough to resolve 90% of these errors.
My code for cleaning the temporary internet files is below... I don't think this will work on all operating systems - there may be a better way - but this suits my needs because it works on Server 2008.
(my code is in vb.net, but the c# version shouldn't be too hard to figure out.)
'start cleaning the temporary internet files
Dim clearFilesProcess As Process = System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 255")
'wait for the temporary internet files to be deleted
While Not (clearFilesProcess.HasExited)
System.Threading.Thread.Sleep(200)
End While