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

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: AjaySingala[Synergetics]
Message 12 in Discussion




  
    
    New Message on MumbaiUserGroup
  
  





      ADO.NET: SqlParameter

    
  
    
      Reply

          
            
                
               
                  Reply to Sender
                    Recommend
                  
                  Message 4 in Discussion
                                                
            
          
        
                    
        
            
              From: 
              AjaySingala[Synergetics]
            
            
              

              


  
    
    New Message on MumbaiUserGroup
  
  





      ADO.NET: SqlParameter

    
  
    
      Reply

          
            
                
               
                  Reply to Sender
                    Recommend
                  
                  Message 3 in Discussion
                                                
            
          
        
                    
        
            
              From: 
              AjaySingala[Synergetics]
            
            
              

              Hi Niyati,

I suppose you have picked this piece of code from somewhere, but are now stuck 
on how to use it. Well, I have written a small piece of code to explain it to 
you, and I have tested it and it works. So, it should be ok for you to follow 
the code.

I created a class called DBHelper and place the methods that you have given 
(Executeparams, AttachParameters and AssignParameterValues) in that class.

Then, I created a form, added a button to it and wrote the following code to 
use the DBHelper class and call the Executeparams method. Here's the code for 
it:

private void button1_Click(object sender, System.EventArgs e)
{
        string ConnectionString = "your connection string here";
        SqlParameter[] oParams = new SqlParameter[1];
        Object[] oValues = new Object[1];
        // Parameters.
        oParams[0] = new SqlParameter();
        oParams[0].ParameterName = "@CustomerID";
        oParams[0].SqlDbType = SqlDbType.NVarChar;
        oParams[0].Size = 5;
        oParams[0].Direction = ParameterDirection.Input;
        // Values for Params.
        oValues[0] = "VINET";

        DBHelper obj = new DBHelper();
        obj.Executeparams(ConnectionString, "CustOrdersOrders", 
oParams,oValues);
}

That's it! That should do it. BTW, the above code was tested on an existing SP 
in the NorthWind DB. This is just FYI. :)

And oh yeah, don't forget to include the namespaces System.Data and 
System.Data.SqlClient in your code.

HTH.

Cheers,

Ajay Singala [Synergetics].


          
        
      
          
  

    View other groups in this category.
  

  

      



          
        
      
          
  

    View other groups in this category.
  

  

      




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

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/mumbaiusergroup/_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