Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #11  
Old 06-05-2008, 10:10 PM
Purva Purva is offline
Junior Member
 
Join Date: Jun 2008
Posts: 13
Default RE: Problem Regarding viewing particular selected record in dbgrid

@ Jasser
No its not working..showing access violation

@davidj..
i want to filter all record except the one ..whichever rollno i entered only it should be displayed.
Reply With Quote
  #12  
Old 06-05-2008, 10:41 PM
davidj davidj is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,900
Default RE: Problem Regarding viewing particular selected record in dbgrid

Your original SQL is filtering out a roll number.
Are you saying that the SQL filter is not working?

I notice you WHERE clause has the filter already?
Reply With Quote
  #13  
Old 06-05-2008, 10:53 PM
Purva Purva is offline
Junior Member
 
Join Date: Jun 2008
Posts: 13
Default RE: Problem Regarding viewing particular selected record in dbgrid

May be...i cant say itz not working..i am not getting why itz not showing result in DBGrid..SQLquery is ok..i am opening query bt nothng haapens when i enter rollno...DBGrid should show record of corresponding rollno but Query1.open not working why?
Reply With Quote
  #14  
Old 06-05-2008, 11:04 PM
davidj davidj is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,900
Default RE: Problem Regarding viewing particular selected record in dbgrid

Have you got a DataSource component connected to the grid.
I seems you are not connecting the Datasource component
to the Query when you create it?
Reply With Quote
  #15  
Old 06-05-2008, 11:07 PM
Purva Purva is offline
Junior Member
 
Join Date: Jun 2008
Posts: 13
Default RE: Problem Regarding viewing particular selected record in dbgrid

...My mistake...I got itz done now following iz the code to display just 1 record which user is asking for.


with STUDENTDB do
begin
with table1 do
begin
{Query1 := nil;
try }
Query1 := TQuery.Create(nil);
Query1.DatabaseName := 'DBDEMOS';
Query1.SQL.Add('Select RollNo,Name,Age,Gender,Stream from StudDB');
Query1.SQL.Add('Where RollNo ="'+RN.Text+'"');
Query1.Open; {open query + display data}

if Query1.IsEmpty then
ShowMessage('ROLL No..Does Not EXIST')
else
begin
DataSource1 := TDataSource.Create(self);
DataSource1.DataSet := Query1;
DBGrid1.DataSource := DataSource1;
Query1.Active;
STUDENTDB.show();
end;
end;
end;

Anywayz thanks for baring my stupid question..
Reply With Quote
  #16  
Old 06-07-2008, 01:20 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,059
Default RE: Problem Regarding viewing particular selected record in dbgrid

In which line you are getting access violation?

Regards,
Abdulaziz Jasser
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 07:35 PM.


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