error in connection string in vb6.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
i am using this code to insert value inn my table ,,,but i got error as--run time error( multiple step OLEDB operation generated error, check each OLEDB status value, if available) please check it what wro开发者_高级运维ng in thos code .....
Look at this:
http://support.microsoft.com/kb/269495
It says:
The following are two possible causes of this error:
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.
If OLEDB_SERVICES entry exists but there is a problem in the ADO connection string, the error occurs.
Do not use this in connection string Persyst Security Info=False;Command Properties='Command Time Out=45'
try this:
rs.Open "insert into student_info(name,rollNo,age,class,address,assigned_teacher) values('n',1,1,'c','a','a')", connexion
For me, the error usually happens when a data is too long for the field. You can further troubleshoot this by updating one field at a time to find the one that is broken (Update name, then update name and number, then name and number and age, etc).
精彩评论