Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I have two fields in search grid where i want to display the varchar values of 2 combos in search grid. But their int values are stored in table.

The two combos are Grade combo and designation combo. Grade combo values comes grade table, and designation's from designation table.how to call for both at the same time
SQL
create PROCEDURE [dbo].[usp_GetGradeAndDesignationByGradeTextAndDesignationTextValue]	 	
@ID varchar(20),
@IDtwo varchar (20)
	 
AS BEGIN  	
SET NOCOUNT ON;     
SELECT  tblGradeMaster.*,tblDesignationMaster.*,tblAllowanceMaster.* 
from tblGradeMaster,tblDesignationMaster,tblAllowanceMaster
WHERE

 tblGradeMaster.grID=tblAllowanceMaster.alGradeID and tblDesignationMaster.desID=tblAllowanceMaster.alDesignID
and grGrade LIKE @ID+'%'  and desDesignation LIKE @IDtwo+'%' 

 END      

This is my stored procedure to get the combo's varchar values in search grid . grade master and allowance master are the ones where i get the combo values. Im storing the combo values id in allowance master. but my question is how to call both of them together in search grid and i want to display their varchar values in search grid
C#
public DataTable GetGradeByGradeTextValue(string p,string q)
       {
           DataTable dt = new DataTable();
           SqlConnection con = new SqlConnection(varConnectionString);
           SqlCommand cmd = new SqlCommand();

           cmd.Connection = con;
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.CommandText = "usp_GetGradeByGradeTextValue";
           cmd.Parameters.Add(new SqlParameter("@ID", p));
         cmd.Parameters.Add(new SqlParameter("@ID", q);

           SqlDataAdapter adapter = new SqlDataAdapter(cmd);

           try
           {
               adapter.Fill(dt);
           }
           catch
           {
               dt = null;

           }

           return dt;
       }

used the above code in Data Layer class and called it in business layer.

how can i call them both below in the same time
C#
protected DataTable GetDataFromDatabaseTemp()
{
 string ID = txtSearch.Text; 
        DynamicMasterBLL dynamicMasterBLL = new DynamicMasterBLL();
        DataTable dataTable = new DataTable();
        //dataTable = dynamicMasterBLL.GetTransactionMaster(gListDynamicControls, DelField, TableName, FieldName);
        dataTable = dynamicMasterBLL.GetGradeByGradeTextValue(ID);
        return dataTable;
}

this is the code i gave in main page. I don know what to declare for 2nd ID(ie IDtwo) in main page. if there are 2 combos varchar field to be added in search grid how can i add.
Note: please let me know how i can add screen shot so that it will be easier to understand
Posted
Updated 20-Dec-12 19:31pm
v2
Comments
Jibesh 22-Dec-12 10:24am    
to upload the image you can use http://imageshack.us/ or http://beta.photobucket.com/login?returnUrl=%2Fupload or even more you can find it in google search with 'free pic upload'. and copy the direct lick to your question.

You can use 'Improve Question' link at the bottom right corner of your question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900