SQL Server VB rs = Server.CreateObject(ADODB.Recordset)失败 [英] SQL Server VB rs=Server.CreateObject(ADODB.Recordset) fails

查看:103
本文介绍了SQL Server VB rs = Server.CreateObject(ADODB.Recordset)失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello。

当我运行ASPX [ASP.NET] VB网页语句rs = Server.CreateObject( "ADODB.Recordset"似乎失败。 我不确定为什么。 我希望你能帮忙解决这个问题。 这是一个重要的问题,因为我的公司在
修复之前无法使用该网站。



我在SQL Server数据库连接字符串上做了一些工作。  ;这是因为(重要的)Ref#1(靠近底部)表示一个错误的conn字符串将导致一个关闭的记录集对象(与我的root问题相同)。



显然在那个特定的帖子中,他的连词很好地连接到他的数据库。 但是他最初使用的提供程序属性(或驱动程序)无法正确读取数据库记录。 因此,返回记录集对象随后自动关闭。



参考#2只显示了如何正确构造conn字符串。 而Ref#3只是所有可能的conn字符串属性的参考。



因此重新构建了我的conn字符串,我得到以下内容。 它快速可靠地连接,但仍然会产生一个封闭的记录集对象。


$
我的问题仍然可以像一个错误的连词串一样简单吗?



  ;   connString =" Provider = SQLNCLI10; " _

        &安培; "服务器= serverName\instanceName; " _

        &安培; "AttachDbFilename = C:\Program Files \ Microsoft SQL Server \" _

        &安培; " MSSQL10_50.SQLEXPRESS\MSSQL\DATA\my_db.mdf; " _

        &安培; "数据库= MY_DB; " _

        &安培; " Trusted_Connection = TRUE; " _


        &安培; "综合安全= SSPI; " _


        &安培; " DataTypeCompatibility = 80; " _


        &安培; "MARS Connection = True; "   
$


$
请为我仔细检查这个conn字符串和/或让SQL服务器专家做同样的事情。



谢谢。



-------------------- --------------------------------------------------

参考编号1:  http://stackoverflow.com/questions/31854468/

             错误操作 - 不允许 - 当对象关闭时



参考#2:  https://msdn.microsoft.com/en-us/library/ms130978.aspx



参考编号3:  https://www.connectionstrings.com/sql-server-2008/



$

When I run my ASPX [ASP.NET] VB web page statement rs=Server.CreateObject("ADODB.Recordset") appears to fail.  I am unsure why.  I hope you can help fix this.  It is an important problem since my company cannot use the website until fixed.

I have been doing some work on my SQL Server db connection string.  This is because (importantly) Ref#1 (near bottom part) indicates that a faulty conn string will cause a closed recordset object (same as my root problem).

Apparently in that particular post, his conn string was good enough to connect to his db.  But the provider attribute (or driver) he originally used could not correctly read the db records.  So the return recordset object was then automatically closed.

The Ref#2 just shows how to properly construct the conn string.  And Ref#3 is simply a reference for all possible conn string attributes.

So having reconstructed my conn string, I get the following.  Which connects speedily and reliably, but still results a closed recordset object.

Can my problem still be as simple as a faulty conn string?

    connString = "Provider=SQLNCLI10; " _
        & "Server=serverName\instanceName; " _
        & "AttachDbFilename = C:\Program Files\Microsoft SQL Server\" _
        & "MSSQL10_50.SQLEXPRESS\MSSQL\DATA\my_db.mdf; " _
        & "Database=my_db; " _
        & "Trusted_Connection=True; " _
        & "Integrated Security=SSPI; " _
        & "DataTypeCompatibility=80; " _
        & "MARS Connection=True; "   


Please carefully check this conn string for me and/or have a sql server expert do same.

Thank you.

----------------------------------------------------------------------
Reference#1:  http://stackoverflow.com/questions/31854468/
              error-operation-is-not-allowed-when-the-object-is-closed

Reference#2:  https://msdn.microsoft.com/en-us/library/ms130978.aspx

Reference#3:  https://www.connectionstrings.com/sql-server-2008/


推荐答案

您好,

请发布完整的错误消息得到;没有我们只能猜测。

Please post the complete error message you get; without we can only guess.

为什么启用MARS,你真的使用这个功能吗?如果不删除参数。

数据库是否已附加到SQL Server,或者您是否真的想在运行时附加它?如果没有删除AttachDbFilename参数

Why is MARS enabled, do you really use this feature? If not remove the parameter.
Is the database already attached to SQL Server, or do you really want to attach it during runtime? If not remove AttachDbFilename parameter

请参阅 https://www.connectionstrings.com/sql- server / 表示有效的连接字符串

See https://www.connectionstrings.com/sql-server/ for valid connection strings


这篇关于SQL Server VB rs = Server.CreateObject(ADODB.Recordset)失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆