Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2005, 10:47 AM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to yossarian Send a message via AIM to yossarian Send a message via MSN to yossarian Send a message via Yahoo to yossarian
Default Assign fields to an ADO rs in C#

I am using a classic ADO recordset in a C# Winforms application. The recordset is created by a VB6 COM+ component and assigned to a recordset variable declared as an ADODB.Recordset type. I am able to instantiate the variable in my C# function and assign the COM+ recordset to the C# recordset; but, I'm having trouble assigning values to the ADO fields using ADO syntax. I'm getting abuild error that states "'ADODB.Recordset' does not contain a definition for 'Fields_Recordset'".

Here's the code I'm using:

// Declare the ADO recordset used in the calling functioon
ADODB.Recordset rs = new ADODB.Recordset();

// Declare and instantiate the COM+ object
Grading.clsGrading gr = new Grading.clsGrading();

// Assign the COM+ ADO recordset to the calling recordset
rs = gr.CreateInput();

//Assign field value
rs.Fields("LoanNbr") = "1003";

Thanks in advance for any assistance provided.

Greg
 
Old January 18th, 2005, 01:12 PM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to yossarian Send a message via AIM to yossarian Send a message via MSN to yossarian Send a message via Yahoo to yossarian
Default

After palying around with my code some more, I found my mistake(s). First, I had to add a using statement for ADODB. Second, I had to use square brakets for the field identifiers and use the .Value to correctly assign the value. The new code looks like this:

using ADODB;

ADODB.Recordset rs = new ADODB.Recordset();

Grading.clsGrading gr = new Grading.clsGrading();

rs = gr.CreateInput();

rs.Fields["LoanNbr"].Value = "1003";





Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between ADO and ADO.NET rakeshclose2u ADO.NET 2 April 23rd, 2007 03:57 AM
Using Forum fields select fields on the fly hellosureshkumar Crystal Reports 0 December 17th, 2004 08:20 AM
checking fields value from rs lucian Dreamweaver (all versions) 4 July 24th, 2004 02:23 AM
RS Manager and RS Server on 2 different computers Choose File BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 July 22nd, 2004 10:56 AM
ADO could ADO counot find the specified provider. Rob Collie Classic ASP Databases 2 June 9th, 2003 04:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.