Solved

Need help in Database (TDataSet)

Posted on 2002-04-14
17
224 Views
Last Modified: 2012-05-04
Hi,

This is my problem:
1) When I click Edit button to edit the current data in the table and then I cancel it and I browse a while other data, why did the application have an exception when I click the edit button again? What I know, it shouldnt happen that way. It should be allright.
2) I want to do like this... Data <num> of <10>... coz there is 10 record count. but how about the <num> part. I can't use RecNo to make it happen. What other option could I do?
3) How to search a certain text in table so it can be display in list?

Hope you understand my language and my question.

iqmedia
0
Comment
Question by:iqmedia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 3
  • +3
17 Comments
 
LVL 9

Expert Comment

by:ginsonic
ID: 6940114
listening
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6940119
what database do you use?
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6940915
listening... don't really understand :)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:Patranjali
ID: 6942193
Hi,
I am not very sure that I have understood your whole question correctly.But I can give u some idea from teh parts I understood.
For the recno part,try using a Query object and add a 'select count(*) from...' statement to it.Store that val in an integer variable and use this in  a loop as ur counter in  'Data <num> of <10>... '.
The other thing about searching for the text , u could try in 2 ways.
1.using  a select statement ,with the 'like % ' parameter
or
2.using locate() function of Delphi.

What Exception did u get when u ttried to edit?

See if you understand what I have written.

Thanks,
Pat
0
 

Author Comment

by:iqmedia
ID: 6942331
Ok... I'm using MSAccess.
In my app. I want it to show to user number of record for the current database.
Example: Record 1 of 10. If you click next button it will show Record 2 of 10. If you delete the 5th record it will be like this.. 1,2,3,4,6,7,8,9,10 but when you browse the 6th record I want it to show Record 5 of 10 not Record 6 of 10.

The exception that I receive is General SQL error. Wrong number of parameter.

Thank Patranjali. If you can answer this, the points is yours.

iqmedia
0
 

Author Comment

by:iqmedia
ID: 6942338
Ok... I'm using MSAccess.
In my app. I want it to show to user number of record for the current database.
Example: Record 1 of 10. If you click next button it will show Record 2 of 10. If you delete the 5th record it will be like this.. 1,2,3,4,6,7,8,9,10 but when you browse the 6th record I want it to show Record 5 of 10 not Record 6 of 10.

The exception that I receive is General SQL error. Wrong number of parameter.

Thank Patranjali. If you can answer this, the points is yours.

iqmedia
0
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 300 total points
ID: 6943634
I suppose you are using ADO? From the help file

TCustomADODataSet.RecNo

The dataset must be active for RecNo to have a valid value. When a dataset component is active, RecNo will be a number between one and the total number of rows in the recordset (reflected in the RecordCount property).

Sample of an event handler in the AfterScroll event of the dataset:

StatusBar1.Panels[0].Text := 'Record ' + IntToStr(TCustomADODataSet(DataSet).RecNo) + ' of ' + IntToStr(TCustomADODataSet(DataSet).RecordCount);


HTH
DragonSlayer
0
 

Author Comment

by:iqmedia
ID: 6943954
The error came out when I do this:
First I click the edit button so the state is dsEdit.
Then I cancel it so the state is dsBrowse.
Then I click next or previous button just for fun.
Then I click the edit button again and this where the error came out.

Thanks DragonSlayer. I'll try it first...

iqmedia
0
 

Expert Comment

by:TomazB
ID: 6945848
listening
0
 

Author Comment

by:iqmedia
ID: 6947011
Hi,

Still no improvement than the last one DragonSlayer. I've try your approach.
This are the error:
General SQL error. Wrong number of parameters.

New on this error!
This error came out when you also doing this,
1) Click edit and cancel it for 3 times...

Anyone can help me on this? and the RecNo..?

iqmedia
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6947015
you need an unique index on your table,
do you have an unique index ?
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6947038
iqmedia, you are sure that the problem arises from the execution of RecNo, and not on stuff before that?
0
 

Author Comment

by:iqmedia
ID: 6947891
The error are not from the exec of RecNo....
I have 3 things:
1) The RecNo
2) The error
3) The searching

iqmedia
0
 

Author Comment

by:iqmedia
ID: 6947897
kretzschmar,

the unique index are for what things as above i mention...?

iqmedia
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6947934
its needed for relocating
the databasecursor
to the correct record

guessing you get the error,
because your app is unable
to relocate

meikl ;-)
0
 

Expert Comment

by:Patranjali
ID: 6948011
listening ..
Pat
0
 

Author Comment

by:iqmedia
ID: 6948182
Hmm... hard to understand and hard to create even maybe a simple function... maybe...

iqmedia
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question