Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > .NET

Lost Password?

Reply
 
Thread Tools Display Modes
  #11  
Old 11-15-2008, 02:23 AM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: Delphi .Net question (codegear 2007)

Just in case anyone else needs to know how to do this:

This is my button click code

var sqll: ansistring;
this: string;
mystringlist: tstringlist;
mysql: string;
i: integer;
begin
//at last, searching with dynamic parameters works

sqldatasource1.SelectParameters.Clear;
mystringlist:=tstringlist.create;
mystringlist.commatext:=textbox1.text;
if mystringlist.count>0 then
begin
mysql:=('SELECT clientsurname,doctype,title from databasetable1 WHERE title like '+quotedstr('%'+mystringlist[0]+'%'));
if mystringlist.count>1 then
for i:=1 to mystringlist.count-1 do
begin
mysql:=mysql+(' AND title LIKE '+QuotedStr('%'+mystringlist[i]+'%'));
end;
mysql:=mysql+(' order by clientsurname');
end;
MYSTRINGLIST.FREE;

SqlDataSource1.SelectParameters.add('myparameter', mysql);
sqldatasource1.SelectCommand:=mysql;

end;



and this is my page load code


var mystringlist: tstringlist;
mysql: string;
i: integer;
begin
// TODO: Put user code to initialize the page here
if textbox1.text='' then exit;
sqldatasource1.SelectParameters.Clear;
mystringlist:=tstringlist.create;
mystringlist.commatext:=textbox1.text;
if mystringlist.count>0 then
begin
mysql:=('SELECT clientsurname,doctype,title from databasetable1 WHERE title like '+quotedstr('%'+mystringlist[0]+'%'));
if mystringlist.count>1 then
for i:=1 to mystringlist.count-1 do
begin
mysql:=mysql+(' AND title LIKE '+QuotedStr('%'+mystringlist[i]+'%'));
end;
mysql:=mysql+(' order by clientsurname');
end;
MYSTRINGLIST.FREE;

SqlDataSource1.SelectParameters.add('myparameter', mysql);
sqldatasource1.SelectCommand:=mysql;
if mypage=0 then begin mypage:=1; gridview1.PageIndex:=0; end;
end;


========================================
A point waiting for the correct answer.

thank you

Jon
Reply With Quote
  #12  
Old 10-10-2009, 05:08 AM
GonyIncense GonyIncense is offline
Junior Member
 
Join Date: Oct 2009
Posts: 1
Default Delphi Net question codegear 2007

Hi,

Can any1 help me out what is the major or important difference between the asp.net and vb.net......since im new to this process cant get a detail description about this. If any1 knows put ur info........
__________________
Enjoy Anonymous Browsing
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:22 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.