Solved

when to call addrecord() in data entry form using DTC's?

Posted on 2000-02-26
7
295 Views
Last Modified: 2006-11-17
friends  i want to create a simple data-entry form using
DTC's. suppose this form is based on a table(emp) containing
 one primary field(ename). i'm using 1 DTC recordset (recordset1,which
is based on sql-->select ename from emp where 1=2, since i
don't want to display any existing record, it has to be only
 a data-entry form and not updateable form.), 1 DTC textbox(ename)
 and a DTC button(save) which i want to use for saving the record.
now my problem is where and when to call addrecord()  method?

i've achieved this goal by using a separate button by clicking which i
call this method. but i want this to happen automatically. so that
i only have to call updaterecord() when i press "save" button.

looking forward for your helping hand.

sandeep
0
Comment
Question by:sandeeptyagi
  • 4
  • 3
7 Comments
 
LVL 1

Expert Comment

by:spruce22
ID: 2563804
Sorry sandeeptyagi, no help here.  But I am curious, what's DTC?

sruce22
0
 

Author Comment

by:sandeeptyagi
ID: 2565569
hi spruce22

u wanted to know about DTC's.

 well... DTC stands for Design Time Control. they come with vis. interdev  6.0 , and are used to reduce the hard-Coding. u can simply drag them over to ur asp page ,change the properties. and that's it. they will generate the equivalent script for u. so u see they are of great use. like for creating a recordset manually, u need to write so many stmts. for ex., creating an instance of connection, recordset, then those commands, locking type, cursor type , command time out and so and so. now if u go for using one of DTC recordset, it's fun. there are several other DTC controls as well.
now u don't take them to be ActiveX controls. these are not ActiveX controls . But only a graphical representation of the same hard-coding. so ultimately u are getting the same stmts( more professionaly written) and ofcourse easy to customise. and therefore u don't need them to be registered anywhere on server or look for any browser plugin.all u need is to know how to use them.

   i would suggest u to try them if u really are unaware of them and so far doing hard-coding. for  i'm sure they'll make ur life comfortable to some extent.

sandeep
0
 
LVL 1

Expert Comment

by:spruce22
ID: 2567266
sandeeptyagi,

Aren't there events for the DTC text box control?  Something like OnChange, or AfterUpdate?  I'm famaliar with events in Access, not ASP but I know there has to be one which would be suitable.  This way, when a user enters data into the text box, you add the new record.  When they are completed they'd press save.

Thanks for the explanation of DTC's:)
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:sandeeptyagi
ID: 2569117
dear spruce22
thanx for ur help. but let me tell u few things about DTc's.
when we use DTC's we get a chance to choose between either server or clint plateform, where we would kike this script to run. now if we choose server, and go for writing afterupdate of textfield then as many times user(surfer) updates(or i should say reenters) the control will go to server to execute the script .and that's highly unwanted.

so u see we can't go for that.

anyway thanx once more and feel free to speak ur mind

sandeep
0
 
LVL 1

Accepted Solution

by:
spruce22 earned 20 total points
ID: 2571270
sandeep,

Yes I see how inefficient that would be.  But let me say this, and tell if I'm off somwhere.  Right now you say you've accomplished the task by adding an extra button to call .AddRecord().  So when the button is pressed, the client page must call the server and add a new record.  It seems like the same thing as the inefficient AfterUpdate idea I had earlier.  Can you take a different approach to the situation? Instead of calling updaterecord() when the Save button is pressed - why don't you submit all the information from the form to an .asp page which calls both .AddRecord and .UpdateRecord.  You could use client side scripting to make sure all necesary data elements were entered, and have the Save button submit the information to let's say "AddRecord.asp".  AddRecord.asp would be the page with the recordset control.  From AddRecord.asp you could use either Request.Form("textboxname") or Request.QueryString("textboxname")(this is dependant on which method the form submits the data with - get or post) to retrieve the data from the form.  I don't know exactly how methods work for DTC controls, but the code might look something like this.

rsDTC.AddRecord()
rsDTC.Field1 = Request.Form("textboxname")
rsDTC.UpdateRecord()

Like I said - I'm somewhat guessing here, but maybe it'll stir up some thoughts for you.  Thanks for your patience and feedback.

spruce22
0
 

Author Comment

by:sandeeptyagi
ID: 2612903
hi spruce22
first of all sorry for the delay. the house was under heavy repairment
 so the system was put at such a place that i couldn't attach it to
 telephone line to access net. however i had received ur reply by then.

well.. what u said was absolutely right if i use 2 separate pages. and it
is not a problem. i wanted to do it with one page only. as of now i
have taken the very same root (2 diffrent pages) and it's working perfectly.
though in future if you come across the exact solution pls. let me know.

regards

sandeep
0
 
LVL 1

Expert Comment

by:spruce22
ID: 2621880
hi sandeep,

No problem on the delay, glad you were able to get your stuff working.  As far as finding the exact solution, it seems to me that you'd always have to use two pages to add the records, unless you wanted the page to update itself.  For example, your form could submit the data to itself, and then you could call the .AddRecord & .UpdateRecord.  But it seems like that would require much more server side scripting than is necesary.  Maybe somebody else would know of a different way to accomplish this, but I'm out of brains:)

spruce22
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now