luckie
asked on
Database, Sessions and Scattering
unit hello;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DB, DBTables;
type
TForm1 = class(TForm)
Query : TQuery;
DataSource : TDataSource;
Database : TDatabase;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender : TObject);
procedure CreateQuery;
const
QueryName = 'select employeeid\n' +
'from details\n';
begin
Database.DatabaseName := 'Peracc.mdb';
Query.DatabaseName := 'Peracc.mdb';
Query.Open;
DataSource.Dataset := Query;
{ edit1.ext := DataSource.Dataset.company .text;}
end;
begin
end;
end.
With the above code snippnet, I'd like to raise 3 questions...
part 1. Database.DatabaseName := 'Peracc.mdb';
Query.DatabaseName := 'Peracc.mdb';
Are these statements workable?
part 2. How do I deal with the 'session' thing?
part 3. How do I scatter the variable 'employeeid' into edit1 (A textbox in C++ sense)?
severely urgent!
Thanks
Jacky
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DB, DBTables;
type
TForm1 = class(TForm)
Query : TQuery;
DataSource : TDataSource;
Database : TDatabase;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender
procedure CreateQuery;
const
QueryName = 'select employeeid\n' +
'from details\n';
begin
Database.DatabaseName := 'Peracc.mdb';
Query.DatabaseName := 'Peracc.mdb';
Query.Open;
DataSource.Dataset := Query;
{ edit1.ext := DataSource.Dataset.company
end;
begin
end;
end.
With the above code snippnet, I'd like to raise 3 questions...
part 1. Database.DatabaseName := 'Peracc.mdb';
Query.DatabaseName := 'Peracc.mdb';
Are these statements workable?
part 2. How do I deal with the 'session' thing?
part 3. How do I scatter the variable 'employeeid' into edit1 (A textbox in C++ sense)?
severely urgent!
Thanks
Jacky
appendix
\n is unusual in pascal and may cause an error
\n is unusual in pascal and may cause an error
ASKER
still no clue...
Could u fix the code snippet for me?
I don't think it's too difficult for an expert like you :)
please don't tell me off.... another :)
Could u fix the code snippet for me?
I don't think it's too difficult for an expert like you :)
please don't tell me off.... another :)
ASKER
I was intending to ask three questions in one... but its too urgent as can be... need to go to interview tomorrow with the code... so bear with me tho...
ASKER
I meant wasn't intending
ASKER
what's the 'aliasname' mean? need to bring the code along tomorrow... so need quick response... thanks
guessing you've never done
a db-app with delphi, right?
well first you must tell me
how you want to connect to the database,
odbc, ado, bde-native, other?
(is it ms-access, and is it a must?)
depending on this you must configure the bde,
except you use ado. do you have expirience with the bde?
another-question, there are dataaware-controls,
which you can use instead of tedit, will you use dataaware-controls?
next question: you can do many assignments at designtime,
will you do the assignments at designtime or runtime?
depending on your answers,
i will try to give you a
step by step instruction
meikl ;-)
a db-app with delphi, right?
well first you must tell me
how you want to connect to the database,
odbc, ado, bde-native, other?
(is it ms-access, and is it a must?)
depending on this you must configure the bde,
except you use ado. do you have expirience with the bde?
another-question, there are dataaware-controls,
which you can use instead of tedit, will you use dataaware-controls?
next question: you can do many assignments at designtime,
will you do the assignments at designtime or runtime?
depending on your answers,
i will try to give you a
step by step instruction
meikl ;-)
Yeah agree with meikl. Need lots more information about which connection method your implemetning and which database you are using. How you connect to the database determines a lot on how the code would be written. And which database you use can affect the syntax the SQL statement.
The Crazy One
The Crazy One
ASKER
still trying... well... I'm using Visual Foxpro database...
I have sort of been setting up something... called the data controls... I've got 3 files... they are personnel1.dbc and per1.dbf and holiday.dbf and that's it
I have been thinking that it would be good enough to set up the properties of the controls in order to control the database ... I've encountered one problem finally... called invalid configuration parameter Alias : personnel1 when I touched on the datafield property any ideas how to get around this...
I have sort of been setting up something... called the data controls... I've got 3 files... they are personnel1.dbc and per1.dbf and holiday.dbf and that's it
I have been thinking that it would be good enough to set up the properties of the controls in order to control the database ... I've encountered one problem finally... called invalid configuration parameter Alias : personnel1 when I touched on the datafield property any ideas how to get around this...
ASKER
Yes, you were right... Zero Experience at alllllllllllllll
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
crazy, did i missed something?
(because that was just from head)
(because that was just from head)
Phew it looks like you got it all meikl. I am impressed with your head. LOL :>)
ASKER
don't worry. Just stuffed it... the interviewer asked me what BOM was... who would know what the hell BOM was... anyway, I could only satify one of the three questions he asked of me... Thanks for helping anyway...
glad to helped you ;-)
but what the hell is BOM?
but what the hell is BOM?
BOM := 'Big Explosion, like in kaboom!!!!'; hehehehehe
ASKER
According to their brains, BOM is 'Bill of Manufacturing'. It's a humanly maintained system that directs the flow of raw materials to finished goods. Bye
ASKER
sorry, not raw materials, but parts...
database.name := 'myDB';
Database.DatabaseName := the aliasname you've defined in the bde;
Query.DatabaseName := the aliasname you've defined in the bde;
or if you want to bundle the tdatasets to the tdatabase
Query.DatabaseName := 'myDB';
part2
what will you deal with this?
there is automatically created a tsession-object named session, all datasets are bound to this session-object, until you assign another
part3
edit1.text := query1.fieldbyname('fieldN
for the future, one question in a question
meikl ;-)