none
having problems with a stored procedure [Using Dataset TableAdapter] RRS feed

  • Question

  • hey guys, I'm having a problem with calling a stored procedure using a table adapter in my dataset

    the stored procedure takes 4 parameters the last two of which are output parameters:

    ALTER proc SeConnecter
    (
    @compte varchar(50), 
    @pass varchar(50),
    @TypeCompte VARCHAR(50) out,
    @Reponse bit out
    )
    AS 
     if exists ( select '' from utilisateurs where UserName=@compte and Pass=@pass)
    	BEGIN 
    		SET @Reponse=1 
    		SELECT @TypeCompte=TypeCompte FROM Utilisateurs
    WHERE UserName=@compte and Pass=@pass END else SET @Reponse=0 GO

    in my dataset i have the stored rocedure in my 'QueriesTableAdapter', For some reason, when i pass in the parameters for the call, i get ane Error :

    "The best overloaded method for Achats.AchatsDataSetTableAdapters.QueriesTableAdapter.SeConnecter(string,string,ref string, ref bool?) has some invalid arguments"

    Here's my C# code :

    using Achats.ACHATSDataSetTableAdapters;
    
    QueriesTableAdapter ConnexionTA = new QueriesTableAdapter();
    Boolean exist = 0;
    String TypeCompte="";
    ConnexionTA.SeConnecter(this.txt_compte.Text,this.txt_pass.Text,TypeCompte,exist);

    am I doing anything wrong? I'm new to C#, never had this sort of problem in VB so I'm quite confused;

    thanks a bunch in advance :)

     

     

    Friday, August 27, 2010 9:00 PM

Answers

  • Hello,

    Please to use the following code snippet:

    Nullable<bool> exist = false;
    // other parameters....
    ConnexionTA.SeConnecter(this.txt_compte.Text, this.txt_pass.Text, ref TypeCompte, ref exist);

    Please have a try and let me know the result!
    Best regards


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Wednesday, September 1, 2010 9:43 AM