简体   繁体   English

未在ConnectionString中指定OLE DB提供程序。 '提供者= SQLOLEDB

[英]An OLE DB Provider was not specified in the ConnectionString. 'Provider=SQLOLEDB

I am creating an application which uses access file from shared network.The application works fine when the access file is placed local.But when I placed it in shared path and trying to connect.It is throwing an exception." An OLE DB Provider was not specified in the ConnectionString. 'Provider=SQLOLEDB Here is my code: 我正在创建一个使用共享网络访问文件的应用程序。将访问文件放置在本地时,该应用程序工作正常。但是,当我将其放置在共享路径中并尝试连接时,它会引发异常。” OLE DB Provider是未在ConnectionString中指定。'Provider = SQLOLEDB这是我的代码:

        string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\server\\MyFirstProject\\SampleDB2.accdb";
        using (OleDbConnection con = new OleDbConnection(connectionString))
        {
            string command = "INSERT INTO emp_status(emp_id,hours,feeded_on,comments)";
            command += "VALUES(@emp_id,@hours,@feeded_on,@comments)";

Could anyone help me how to resolve this issue and Am I missing something? 谁能帮我解决这个问题,我有什么遗漏吗? I am using OLEB as a datasourse and Access 2013 Any Suggestions or explanations would definitely helps me. 我正在使用OLEB作为数据源和Access2013。任何建议或解释都一定会对我有所帮助。

Thanks in advance!! 提前致谢!!

You need to escape the leading double slash as well... 您还需要逃脱领先的双斜线...

string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\\\server\\MyFirstProject\\SampleDB2.accdb";

I haven't got anything to check this on here, but I'm fairly sure this is your answer. 我没有什么可以在这里检查的,但是我很确定这是您的答案。 Also, watch out for reserved words, Eg "hours" might be one in which case it should be [hours]. 另外,请注意保留字,例如“ hours”可能是一个“ hours”。

Also, you haven't specifically included adding the parameter values in your question. 另外,您还没有明确地在问题中添加参数值。 I assume you are doing it but if not then see my coding example here... 我认为您正在这样做,但是如果没有,请在此处查看我的编码示例...

VB 2010 error (INSERT INTO) syntax error VB 2010错误(INSERT INTO)语法错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未在ConnectionString中指定OLE DB提供程序。 例如,“ Provider = SQLOLEDB;” - An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;' 未在ConnectionString中指定OLE DB提供程序。 'Provider = SQLOLEDB; - An OLE DB Provider was not specified in the ConnectionString. 'Provider=SQLOLEDB; 如何使用 VFP OLE DB 提供程序关闭表 - How to close a table with the VFP OLE DB Provider 基础提供程序在ConnectionString上失败 - The underlying provider failed on ConnectionString 在 EF 6 连接字符串中使用 provider=SQLOLEDB - Use of provider=SQLOLEDB in EF 6 connection string 基础提供程序连接字符串失败 - Underlying provider failed in connectionstring Microsoft Office 12.0 Access 数据库引擎 OLE DB 提供程序 - Microsoft Office 12.0 Access database engine OLE DB Provider 如何获得提供者名称以打开Ole DB连接? - How do I get provider name to open Ole DB connection? 使用OLE DB .NET Provider插入数据库表将不起作用 - Insert into database table with OLE DB .NET Provider won't work 以编程方式添加SSIS连接 - OLE DB的Oracle提供程序 - Adding SSIS Connections Programmatically - Oracle Provider for OLE DB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM