-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: SathishRaj
Message 5 in Discussion

Hi Sitaram,

I got struckup in getting the "SQL property from the command object of
Mseq.dll" through reflection.  
Thanks a lot for sending the exact code what I required. 
  
Thanks and Regards,
Sathish Raj

> -----Original Message-----
> From: Sitaraman [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, July 31, 2003 12:12 PM
> To:   BDOTNET
> Subject:      Re: Microsoft English Query Language in C#
> 
>  
> <http://c.msn.com/c.gif?NC=9523&NA=34131&PS=&PI=26283&DI=416&TP=http://gro
> ups.msn.com>
>   <http://sc.groups.msn.com/themes/pby/img/mail/mlstar.gif>   New Message
> on BDOTNET <http://groups.msn.com/BDotNet>     
>   <http://sc.groups.msn.com/img/c.gif>        
> 
> 
>       Microsoft English Query Language in C#
> <http://groups.msn.com/BDotNet/_notifications.msnw?type=msg&action=showdis
> cussion&parent=1&item=4157>
>       
>       
> Reply
> <mailto:[EMAIL PROTECTED]
> %20Language%20in%20C%23>
>   <http://sc.groups.msn.com/img/c.gif>                 Reply to Sender
> <mailto:[EMAIL PROTECTED]
> Language%20in%20C%23>    Recommend
> <http://groups.msn.com/BDotNet/_notifications.msnw?type=msg&action=recomme
> nd&parent=1&item=4166>        Message 3 in Discussion         
> From: Sitaraman <http://groups.msn.com/BDotNet/profile?user=Sitaraman>
> 
> 
> 
> Hi Pandu,
>  
> that wont work.   will give u these errors
>  
> 'object' does not contain a definition for 'Commands'
> 'object' does not contain a definition for 'InitDomain'
> 'object' does not contain a definition for 'ParseRequest'
>  
> Satish - u need to understand that VB supports late binding so it is easy
> to declare a object type and call methods and make them bind at runtime.
> In fact even in VB(VB.Net),   you should not use late bind as it has a
> performance overhead.   Anyways the following is the code in C# and VB(if
> u plan to use VB for this use early binding as below) both of them using
> early binding.   However to get the "Response Object from the
> parseRequest" and "sql property from the command object" i needed to use
> reflection. it is as follows. For this to work, add a reference to the
> Microsoft English Query Type Library 2.0 (available in the List of the COM
> tab of the Add References Dialog box)
>   _____  
> 
> C#
> public String GetNlSqlQueryCSharp(String nlEngQuery)
>   {
>    //Add Reference to Microsoft English Query Type Library 2.0 for this fn
> to work
>     Mseq.SessionClass msEqSession ;
>     Mseq.Response   msEqResponse;
>     Mseq.Commands l_objCommands;   
>     Mseq.Command l_objCommand; 
>   
>    //create object
>     msEqSession = new Mseq.SessionClass();
>    //initialize the file
>     msEqSession.InitDomain(strNlqDefinition);
>    
>    //parse eng query and get Response Object
>     msEqResponse = msEqSession.ParseRequest(nlEngQuery);
>    //Get the Commands From the Response
>     l_objCommands =
> (Mseq.Commands)msEqResponse.GetType().InvokeMember("Commands",BindingFlags
> .GetProperty,null,msEqResponse,null);
>    
>    //Get the Command from the Commands
>     l_objCommand=l_objCommands.Index(0);
>    
>    //Get the SQL Query from the Command Object
>     Object
> l_strSQL=l_objCommand.GetType().InvokeMember("sql",BindingFlags.GetPropert
> y,null,l_objCommand,null);
>    
>    //return the SQL String                              
>     return l_strSQL.ToString();
> 
>   }
> 
>   _____  
> 
>  
>   _____  
> 
> VB.Net
> Public Function GetNlSqlQueryVBEarlyBind(ByVal nlEngQuery As String) As
> String
>          'Add Reference to Microsoft English Query Type Library 2.0 for
> this fn to work
>          Dim msEqSession As Mseq.Session
>          Dim msEqResponse As Mseq.Response
>          'create object
>          msEqSession = New Mseq.Session()
>          'initialize the file
>          msEqSession.InitDomain(strNlqDefinition)
>          'parse eng query and get commonds object
>          msEqResponse = msEqSession.ParseRequest(nlEngQuery)
>          'return sql query string
>          If msEqResponse.Type.ToString = "nlResponseCommand" Then
>              Return msEqResponse.Commands(0).sql.ToString
>          Else
>              Return "Problem in English Query"
>          End If
>      End Function
>   _____  
> 
>  
> hope this helps
>  
> regards,
>  
> sr
>  
> 
>  
>  
> 
>       View other groups in this category.
> <http://groups.msn.com/Browse?CatId=26> 
>       
>       Click Here!
> <http://g.msn.com/0AD00001/503024.1??PID=2001966&UIT=M&TargetID=1014733&AN
> =28868&PG=WBCCOM> 
> 
> 
> Also on MSN:
> Start Chatting <http://g.msn.com/2GRENUS/2_8085_01> |   Listen to Music
> <http://g.msn.com/2GRENUS/2_8085_02> |   House & Home
> <http://g.msn.com/2GRENUS/2_8085_03> |   Try Online Dating
> <http://g.msn.com/2GRENUS/2_8085_04> |   Daily Horoscopes
> <http://g.msn.com/2GRENUS/2_8085_05>          
> 
>   <http://sc.groups.msn.com/img/c.gif>        
> 
> 
>       To stop getting this e-mail, or change how often it arrives, go to
> your E-mail Settings <http://groups.msn.com/BDotNet/_emailsettings.msnw>. 
>       
>       Need help? If you've forgotten your password, please go to Passport
> Member Services <http://groups.msn.com/_passportredir.msnw?ppmprop=help>. 
>       For other questions or feedback, go to our Contact Us
> <http://groups.msn.com/contact> page. 
>       
>       If you do not want to receive future e-mail from this MSN group, or
> if you received this message by mistake, please click the "Remove" link
> below. On the pre-addressed e-mail message that opens, simply click
> "Send". Your e-mail address will be deleted from this group's mailing
> list. 
>       Remove my e-mail address from BDOTNET.
> <mailto:[EMAIL PROTECTED]> 
> 
> 
____________________________________________
Confidential:  This electronic message and all contents contain information
from Syntel, Inc. which may be privileged, confidential or otherwise
protected from disclosure. The information is intended to be for the
addressee only. If you are not the addressee, any disclosure, copy,
distribution or use of the contents of this message is prohibited.  If you
have received this electronic message in error, please notify the sender
immediately and destroy the original message and all copies.


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to