الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

how to make a search form in ASP.NET 2.0

مغلق
بدأه Rmahdy في 21 يونيو 2007 · 1 رد · 1,161 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Dear Sirs,

i have a Question about ASP.NET 2.0

the question is : how can i make a Search Form in my project ?

NOTE: You can answer in Arabic OR in English

i have a database for Customers, The Table Customer including [CustomerName, CustomerCountry, CustomerCity]

and i have a ASP.NET 2.0 form with 4 TextBoxes

textbox1 = CustomerName

textbox2 = CustomerCountry

textbox3 = CustomerCity

and i have a 1 Button for Search.

in want when he enter

CustomerName = Ahmed

Customer City = (empty)

Customer Country = KSA

and press serch button

i want to return all the users in the database in a gridview who have the name ahmed and from KSA

i'm using asp.net 2.0 and SQL server 2005

please i need help as fast as you can

thx

#2

طيب الاخ الكريم اللي سأل السؤال , البحث عملية مفيدة جدا وبتم باستعلام مفلتر بشروط Where

ولازم تاخد بالاعتبار انو ما منقارن ضمن الاستعلام بالعلامة = وإنما بالمصطلح like

فمثلا لازم نبحث نحن في المثال السابق كالتالي:

{
strin SQL= "SELECT * FROM Customer Where CustomerName like '%"+textbox1.Text.Replace("'","''")+"%'  AND CustomerCountry like '%"+textbox2.Text.Replace("'","''")+"%' AND  CustomerCity like '%"+textbox3.Text.Replace("'","''")+"%' ";

//Here you will use this SQL to fetch Returned rows and Bind it into any Databound Control.
//Please be notice that you can use SqlDataSource Controls with including some parameters in the SelectCommand  Property and give the value of this parameters in Button_Click event handler
}

هذا ما أعلم والله أعلم

هذا الموضوع مغلق.

مواضيع مشابهة