小编Khi*_*Ali的帖子

使用SMO库从C#中的Application运行.sql文件

我正在C#visual studio 2012 RC中构建应用程序.

我必须在应用程序中运行脚本.为此,我正在使用.这两个库.我的应用程序的目标.net框架是4.5.

using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
Run Code Online (Sandbox Code Playgroud)

在检查天气数据库是否存在后,我编写了运行脚本的代码.

当我运行代码时会弹出一个意外的异常.我真的知道这是什么意思.你可以帮助我摆脱这个例外.

我也附加了我的代码和异常预览.

请帮助我......我已经搜索过太多了.

在此输入图像描述

**Here are the Exception Details.**
Run Code Online (Sandbox Code Playgroud)

未处理System.IO.FileLoadException HResult = -2146232799消息=混合模式程序集是针对运行时的版本"v2.0.50727"构建的,如果没有其他配置信息,则无法在4.0运行时中加载.Source = mscorlib StackTrace:System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly程序集,String name,Boolean throwOnError,Boolean ignoreCase,ObjectHandleOnStack类型),位于System.Reflection.RuntimeAssembly.GetType(String name,Boolean throwOnError,Boolean ignoreCase). Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand,Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String query,ExecutionTypes executionType,Int32&statementsToReverse)中的Reflection.Assembly.GetType(String name,Boolean throwOnError). ExecutionTypes executionType)在Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand)位于McFarlaneIndustriesPOSnamespace.SplashScreen.CreateDatabase()的e:\ Works\McFarlane Industries\McFarlane Industries销售点源代码\ McFarlaneIndustries\SplashScreen.cs:第139行在McFarlaneIndustriesPOSnamespace.SplashScreen.splashScreenTimer_Tick(对象发送者,EventArgs e))在e:\ Works\McFarlane Industries\McFarlane Industries销售点源代码\ McFarlaneIndustries\SplashScreen.cs:System.Windows.Form.Timer.TimerNativeWindow上的System.Windows.Forms.Timer.OnTick(EventArgs e)第159行System.Windows.Forms上的System.Windows.Forms.FornsWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)中的.WndProc(Message&m)位于System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&msg). System.Windows.Forms上的System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,ApplicationContext context)中的Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID,Int32 reason,Int32 pvLoopData)位于E:\ Works\McFarlane Industries\McFarlane Industries Point of S的McFarlaneIndustriesPOSnamespace.Program.Main()的System.Windows.Forms.Application.Run(Form mainForm)中的.Application.ThreadContext.RunMessageLoop(Int32 reason,ApplicationContext context)ale源代码\ McFarlaneIndustries\Program.cs:在System.Runtime.Hosting.ManifestRunner的System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly,String [] args)的System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly,String [] args)第19行System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext,String [] activationCustomData)中的System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()处于System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)的.Run(Boolean …

.net c# sql smo sql-server-2008

5
推荐指数
1
解决办法
2645
查看次数

在C#应用程序中使用b-pac SDK标记打印开发

我正在Visual Studio 2012 RC中开发一个POS系统C#应用程序.我必须使用标签打印机打印销售

兄弟P-Touch QL-500标签打印机.

我已经做了什么.

  • 我已经安装了最新的b-pac SDK 3.0
  • 成功添加对我的C#应用​​程序的引用.
  • 为了创建标签模板,我安装了最新版本的p-touch Editor 5.0.
  • 制作了一个模板(Mylabel.lbl).

    但在那之前.

我运行一些内置的示例,但这些示例引发异常.在谷歌上做了很多搜索之后我发现这是打印机的驱动程序问题.

我无法安装驱动程序,因为驱动程序的安装需要连接打印机. 我没有打印机.

我需要做什么

  • 你知道我怎么能做这个任务吗?
  • 使用兄弟P-Touch QL-500标签打印机打印标签的正确方法是什么.

    请帮帮我,我已经做了很多时间搜索.stackoverflow是我最后的希望.我是这种标签印刷的新手.请帮助我将非常感激.

我正在使用的ruff示例代码.

bpac.DocumentClass doc = new DocumentClass();
if (doc.Open("templateFile.lbx"))
{
    doc.GetObject("field1").Text = "...";
    doc.GetObject("field2").Text = "...";

    doc.StartPrint("", PrintOptionConstants.bpoDefault);
    doc.PrintOut(1, PrintOptionConstants.bpoDefault);
    doc.EndPrint();
    doc.Close();
}
Run Code Online (Sandbox Code Playgroud)

这是我正在尝试的示例代码.第一行抛出异常

bpac.DocumentClass doc = new DocumentClass();
Run Code Online (Sandbox Code Playgroud)

我还附加了异常屏幕预览.

抛出异常屏幕预览

.net c# printing label

2
推荐指数
1
解决办法
1万
查看次数

Chrome 扩展:内容脚本无法将本地 HTML 文件加载到 iframe

manifest.json 中定义了一个内容脚本。内容脚本正在执行一项简单的任务。它将iframe添加到页面中并尝试在其中打开本地 HTML文件。

问题是:

ifrm.setAttribute("src", "http://www.xyz.com/");   //working correctly.
Run Code Online (Sandbox Code Playgroud)

ifrm.setAttribute("src", chrome.extension.getURL("view/abc.html")); //Not working
Run Code Online (Sandbox Code Playgroud)

iframe 未打开本地 HTML 文件

任何建议...

html javascript iframe google-chrome-extension content-script

0
推荐指数
1
解决办法
3368
查看次数