Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > ADO Data > Error message w...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 4234 of 4320
Post > Topic >>

Error message when opening a recordset with a strem containing xml

by =?Utf-8?B?U1I=?= <SR@[EMAIL PROTECTED] > May 15, 2008 at 05:13 AM

I have a problem when trying to open a recordset with a stream including
xml 
content. 

The code line that triggers the error looks like this:

tempRecordsetClass.Open(xmlStream, tempRecordsetClass.Source, 
tempRecordsetClass.CursorType, tempRecordsetClass.LockType, (int) 
ADODB.CommandTypeEnum.adCmdUnspecified);

I get the following error message:

System.Runtime.InteropServices.COMException
Message = [Microsoft][ODBC Driver Manager] Data source name not found and
no 
default driver specified

I have also modified some of the parameters so it looks like this: 

tempRecordsetClass.Open ((ADODB._Stream)xmlStream, noParam, 
ADODB.CursorTypeEnum.adOpenUnspecified,
ADODB.LockTypeEnum.adLockUnspecified, 
(int)ADODB.CommandTypeEnum.adCmdUnspecified);

where noParam is a system object with the value 
"System.Reflection.Missing.Value"

But then I get another error message instead:

System.InvalidCastException
Message = Unable to cast COM object of type 'System.__ComObject' to class 
type 'ADODB.RecordsetClass'. COM components that enter the CLR and do not 
sup****t IProvideClassInfo or that do not have any interop assembly
registered 
will be wrapped in the __ComObject type. Instances of this type cannot be 
cast to any other class; however they can be cast to interfaces as long as

the underlying COM component sup****ts QueryInterface calls for the IID of
the 
interface.

Now I need your help, please.

The total content of the module is the following:

	public virtual Recordset toRecordset(Do***ent doc, Recordset rsEmptyAI)
		{
			System.String xml = null;
			Recordset rsNewAI = new Recordset();
			_Stream xmlStream = new Stream();
			System.Object noParam = new System.Object();
			noParam = System.Reflection.Missing.Value;
			System.String schemaText = null;
			
			ADODB.RecordsetClass rsUnmodifiedWFC = new ADODB.RecordsetClass();
			ADODB.RecordsetClass rsNewWFC = null;
			
			try
			{
				// save the empty recordset to a stream
				rsEmptyAI.Save(xmlStream, PersistFormatEnum.adPersistXML);
				schemaText = xmlStream.ReadText((int)StreamReadEnum.adReadAll);
				
				// get just to <rs:data>
				schemaText = schemaText.Substring(0, 
(schemaText.IndexOf(com.volvo.vtc.sprint.bussvc.assembly.copybtwfactories.xml.IElements.rs_data))
- (0));
				
				xml = XMLHelper.toXML(doc);
				
				// get from <rs:data> to end
				xml = 
xml.Substring(xml.IndexOf(com.volvo.vtc.sprint.bussvc.assembly.copybtwfactories.xml.IElements.rs_data),

(xml.Length) - 
(xml.IndexOf(com.volvo.vtc.sprint.bussvc.assembly.copybtwfactories.xml.IElements.rs_data)));
				xml = schemaText + xml;
				
				// get a new stream
				xmlStream = new Stream();
				
				// open the stream
				xmlStream.Open(noParam, ADODB.ConnectModeEnum.adModeUnknown, 
ADODB.StreamOpenOptionsEnum.adOpenStreamUnspecified, null, null);
				
				// write to a stream
				xmlStream.WriteText(xml, ADODB.StreamWriteEnum.adWriteChar);
				xmlStream.Flush();
				
				// set cursor at the begining
				xmlStream.Position=0;
				
				ADODB.RecordsetClass tempRecordsetClass;
				tempRecordsetClass = rsUnmodifiedWFC;
				tempRecordsetClass.Open(xmlStream, tempRecordsetClass.Source, 
tempRecordsetClass.CursorType, tempRecordsetClass.LockType, (int) 
ADODB.CommandTypeEnum.adCmdUnspecified);
				
				rsNewWFC = (ADODB.RecordsetClass)rsEmptyAI;
				
				// copy the unmodified recordset to the empty, then it will be in
status 
new
				this.copyRecordData(rsUnmodifiedWFC, rsNewWFC);
				
				rsNewAI.Source =((System.Object) rsNewWFC.DataSource);
			}
			catch (System.Exception t)
			{
				throw SPServerException.toServerException(t);
			}
			
			return rsNewAI;
		}
 




 1 Posts in Topic:
Error message when opening a recordset with a strem containing x
=?Utf-8?B?U1I=?= <SR@[  2008-05-15 05:13:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 15:49:20 CST 2008.