Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datagrid without addnew or update properties

Status
Not open for further replies.

mur3x

MIS
Sep 8, 2003
31
LK

Hi!!, I wud really appreciate any help for the problem below.
well i use a datagrid to input multiple fields of data,

for example,

col1(module name) | col2(hrs)
----------------------------------------
mod1 | 12
mod2 | 8
mod3 | 6

I dont want to use Datagrids allowAddnew or allowupdate
properties. I want to save the contents of the grid to
table only after the SAVE button is clicked, that is in the
format of,

Cno,Module,hrs -> 1,mod1,12
Cno,Module,hrs -> 1,mod2,8
Cno,Module,hrs -> 1,mod3,6
etc....

note: Cno is a reference (foreign key) of another table.

i wud be very pleased if someone cud suggest an idea to get
around this..


thnx!
Mur.
 
Disconnect the recordset from the connection and use BatchUpdating.
 
well thnx for the reply!,,i d'nt get what u said..
anyways i'll let u know what my requirement is.

i hav 2 recordsets namely rs1 & rs2.

rs1 - select cno,name,totalhrs from course
rs2 - select modno,name,cno,remhrs from module

I add records like below,

Code:
Private Sub cmdAdd_Click()

rs1.AddNew
rs1.MoveLast
strCno = rs1("cno") + 1

End Sub



Private Sub cmdsave_Click()

rs1("cno") = strCno
rs1("name") = txtCName.Text
rs1("totalhrs") = txtCHrs.Text

rs1.update
End Sub


At the same time i want to insert into rs2 values of the modules.
there can be many modules so i use a datagrid to enter.

Code:
set dg1.datasource=rs2

I want insert only name & remhrs. modno is a autofield. cno is the value
of 'strCno'.
I think u get the problem by now. so when adding a field to the datagrid
brings up an error "you need a related record in table course". thats why
i suggested that without the allowAddNew & allowUpdate properties can i send
all datagrid data at once to rs2 when cmdSave is clicked.


appreciate ur input!

thnx!!!
Murshid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top