.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 16th, 2004, 08:01 PM
naveena naveena is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 naveena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Using Adodb.Command.Execute Method in C# and ASp.net

Can anyone please help me figure out what each of the parameters in this function mean

ADODB.Recordset_Command.Execute(out Object RecordsAffected, ref objParameters ,int options)

I am trying to query an Active Directory using c# in asp.net

After connecting to the active directory. I am unable to execute this command which retreives the data from
the active directory. Execute method is supposed to return a record set, But i am unable to figure out the
parameters of Execute method

Code:
ADODB.Connection Conn=new ADODB.Connection();
ADODB.Recordset rs=new ADODB.RecordsetClass();
Conn.Provider="ADsDSOObject";
ADODB.Command cmd=new ADODB.Command();
Conn.Open("Active Directory Provider",null,null,0);
cmd.ActiveConnection=Conn;
i have also specified the command text.
rs=cmd.Execute(?,?,?)

Can any one help me with this

Thank you

Reply With Quote
  #2  
Old June 18th, 2004, 09:38 AM
maxwell maxwell is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 maxwell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The Answer from France

Try to use this code to execute your command !

object dummy = Type.Missing;
ADODB.Recordset rs = cmd.Execute(
out dummy, ref dummy, 0);

OML is everywhere !

Reply With Quote
  #3  
Old October 20th, 2008, 07:51 PM
taKing taKing is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 1 taKing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 46 sec
Reputation Power: 0
This worked for me

ADODB.Recordset objRS = null;
try
{
ADODB.Connection objConn = new ADODB.Connection();

int intConnectionMode = (int)ConnectModeEnum.adModeUnknown;
objConn.Open("Provider='SQLOLEDB';Data Source='MyServer'; Initial Catalog='MyDataBase';", UserName, Password, intConnectionMode);
objConn.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
object objRecAff;
ADODB.Command cmd = new ADODB.Command();
cmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc;
cmd.ActiveConnection = objConn;
cmd.CommandTimeout = 600;
cmd.CommandText = "MyStoredProcName";
cmd.Parameters.Refresh();
cmd.Parameters["@employeeID"].Value = 68;
cmd.Parameters["@startDate"].Value = "1/1/2008";
cmd.Parameters["@DaysToGet"].Value = 30;
object objParameters = cmd.Parameters;
objRS = (ADODB.Recordset)cmd.Execute(out objRecAff, ref objParameters, (int)ADODB.CommandTypeEnum.adCmdStoredProc);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}

return objRS;
}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Using Adodb.Command.Execute Method in C# and ASp.net


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap