2010-10-05 71 views
0
Dim rs As New ADODB.Recordset 



strConnectionString = "Provider=SQLOLEDB.1;Integrated Security=True;Initial Catalog=Hospital_ABC;Data Source=ITEM-47791\SQLEXPRESS;Persyst Security Info=False;Command Properties='Command Time Out=45'" 





Set connexion = New ADODB.Connection 

connexion.ConnectionString = strConnectionString 

connexion.ConnectionTimeout = 30 

connexion.Open strConnectionString 

rs.Open "insert into student_info(name,rollNo,age, class,address,assigned_teacher)values('name',rollno,age,'cls','add','assteac')", connexion 

我使用这个代码中插入值客栈我的表,,,但我得到的错误是 - 运行时错误(多步OLEDB产生的操作错误,请检查每个OLEDB状态值,如果有的话) 请检查错误在VB6.0连接字符串

回答

1

看看这个是什么错茨艾伦代码.....:

http://support.microsoft.com/kb/269495

它说:

The following are two possible causes of this error:

  1. In the registry, under the key for an OLE DB provider's CLSID, there may be an entry named OLEDB_SERVICES. If the OLE DB provider that is used to make the ADO connection does not have the OLEDB_SERVICES entry, and ADO tries to set up a property that is not supported by the provider, the error occurs. For more information about this registry entry, see the "Resolution" section.

  2. If OLEDB_SERVICES entry exists but there is a problem in the ADO connection string, the error occurs.

0

试试这个:

rs.Open "insert into student_info(name,rollNo,age,class,address,assigned_teacher) values('n',1,1,'c','a','a')", connexion 

对我来说,当一个数据太长字段的错误通常发生。您可以通过每次更新一个字段来查找故障(更新名称,然后更新名称和编号,名称和编号以及年龄等),以进一步排除故障。

1

不要在连接字符串中使用它 Persyst Security Info = False; Command Properties ='Command Time Out = 45'