PDA

View Full Version : استورپریسجر جستجو



javad13
جمعه 02 اسفند 1392, 11:36 صبح
سلام به همگی.
در صفحه اصلی سایت جستجو پیشرفته ای گذاشتم که شامل چند لیست کشویی و تکس باکس هستش.
من زیاد با استورپرسیجر ها کار نکردم و فقط ازتون میخوام ببینید آیا دستورات کانورتی که نوشتم با توجه به انواع ورودی های استورپرسیجر درست هستش یا نه ؟


ALTER procedure [dbo].[Search](@valuedrNoKhodro int,@valueOstan int,@valueModel int,@strSefr bit,@intOtagh tinyint,@bitchkPic bit,@strGheymat nvarchar(50),@strTagheymat nvarchar(50))
as
begin
if (len(@strGheymat) = 0 and ( CONVERT(int,@bitchkPic)= 0 ) and CONVERT(int,@strSefr) = 0 and @intOtagh = 1 )


لطفا ببینید دستور if من درست هستش یا نه .
تابعی که پارامترهارو ارسال میکنه به صورت زیر هستش:


public void BindGridView(GridView ddl, int drValueNoKhodro, int valueOstan, int valuemodel, int strSefr, int strOtagh, int bitchkPic, string strGheymat, string strTagheymat)
{
SqlConnection sqlcon = new SqlConnection(conString);
SqlDataAdapter dad = new SqlDataAdapter();
dad.SelectCommand = new SqlCommand();
dad.SelectCommand.Connection = sqlcon;
dad.SelectCommand.CommandText = "Search";
dad.SelectCommand.CommandType = CommandType.StoredProcedure;
dad.SelectCommand.Parameters.AddWithValue("@valuedrNoKhodro", drValueNoKhodro);
dad.SelectCommand.Parameters.AddWithValue("@valueOstan",valueOstan );
dad.SelectCommand.Parameters.AddWithValue("@valuemodel",valuemodel );
dad.SelectCommand.Parameters.AddWithValue("@strSefr",strSefr );
dad.SelectCommand.Parameters.AddWithValue("@intOtagh", strOtagh);
dad.SelectCommand.Parameters.AddWithValue("@bitchkPic",bitchkPic );
dad.SelectCommand.Parameters.AddWithValue("@strGheymat", strGheymat);
dad.SelectCommand.Parameters.AddWithValue("@strTagheymat", strTagheymat);
DataTable dttblParent = new DataTable();
dad.Fill(dttblParent);
ddl.AllowPaging = true;
ddl.PageSize = 15;
ddl.DataSource = dttblParent;
ddl.DataBind();
}


این تابع از یک کلاس هستش که در رویداد لود صفحه جستجو فراخوانی میشه .