Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL Server 2000 question!

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support
View previous topic :: View next topic  
Author Message
namnh81



Joined: 09 Oct 2007
Posts: 2

PostPosted: Tue Oct 09, 2007 3:39 am    Post subject: SQL Server 2000 question! Reply with quote

Hi infralution team,
I'm trying VDO with SQL Server 2000, i'm using SQLOLEDB provider in ConnectionSSString like:

Provider=SQLOLEDB;Data Source=sserver;Initial Catalog=sdatabase;User ID=suser;Password=spassword;
but my App show error when running line 'if(rs.Count > 0)':

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in SynchIFN.exe
Additional information: Operation is not allowed when the object is closed.

I tried setting CursorLocationEnum.adUseClient, or CursorTypeEnum.adOpenKeyset, or both but that error still exists!
Could you explain to me why it is? I missed something or VDO not use with SQL Server 2000?
Code:
VirtualConnection connection = new VirtualConnection(DBConfiguration.ConnectionSSString, "", "", -1, 5);
//connection.CursorLocation = CursorLocationEnum.adUseClient;
//connection.CursorType = CursorTypeEnum.adOpenKeyset;
VirtualRecordset rs = new VirtualRecordset(connection, "MyTable", "MyID", "SELECT * FROM MyTable WHERE MyID> 10509000") ;
if(!rs.Count > 0)
{
VirtualRecord vr = rs[0];
string sURL = vr["URL"].ToString();
}
Regards
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4972

PostPosted: Tue Oct 09, 2007 6:18 am    Post subject: Reply with quote

VDO should work with SQL Server. I've just built a small sample project similar to your code to connect to an SQL database and it worked without any issues.

I assume this line:

Code:
if(!rs.Count > 0)


is a typo error - because it won't compile.

What version of VDO are you using?
Can you give me the full stack trace when the error is thrown?

Normally with VDO you don't put the WHERE clause in the SELECT statement. Instead you set the WhereClause property for the VirtualRecordset and let VDO construct the full query. I don't think this would be causing you issue however.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
namnh81



Joined: 09 Oct 2007
Posts: 2

PostPosted: Tue Oct 09, 2007 7:54 am    Post subject: Reply with quote

Thanks you for your immediate response,
sorry about my wrong typing code, I use VDO 1.3. Here is my code:
DBConfiguration.ConnectionSSString="Provider=SQLOLEDB;Data Source = sserver;Initial Catalog =sdatabase;User ID =suser;Password =spassword;";
VirtualConnection connection = new VirtualConnection(DBConfiguration.ConnectionSSString, "", "", -1, 5);
//connection.CursorLocation = CursorLocationEnum.adUseClient;
//connection.CursorType = CursorTypeEnum.adOpenKeyset;
VirtualRecordset rs = new VirtualRecordset(connection, "MyTable", "MyID", "SELECT URL FROM MyTable") ;
rs.WhereClause = "MyID> 10509000";
if(rs.Count > 0)
{
VirtualRecord vr = rs[0];
string sURL = vr["URL"].ToString();
}

An here is stack trace:

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x800A0CC1): Item cannot be found in the collection corresponding to the requested name or ordinal.
at ADODB.Fields.get_Item(Object Index)
at ADODB.InternalFields.get_Item(Object index)
at Infralution.VirtualData.VirtualRecord.GetPrimaryKeyValue(Recordset rs)
at Infralution.VirtualData.VirtualRecord.Initialize(VirtualRecordset virtualRecordset, Recordset rs)
at Infralution.VirtualData.VirtualRecordset.CreateVirtualRecord(Recordset rs)
at Infralution.VirtualData.VirtualRecordset.GetVirtualRecord(Int32 index)
at Infralution.VirtualData.VirtualRecordset.get_Item(Int32 index)
at IFNTool.Form1.button1_Click(Object sender, EventArgs e) in i:\projects\synchifn\form1.cs:line 566
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
............................

Regards
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4972

PostPosted: Tue Oct 09, 2007 9:02 am    Post subject: Reply with quote

Your stack trace does not seem to match where you say the exception is occurring. If the exception occurs while executing the line:

Code:
if(rs.Count > 0)


Then I would expect to see the VirtualRecordset.Count method in the stack trace. Could you perhaps zip your sample project and email it to support@infralution.com so we can see exactly what you are doing.

It might also be worthwhile downloading and installing the latest version of VDO (1.3.1) to confirm that the problem exists in the latest version.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group