Gustavo

Gustavo

  • NA
  • 1.8k
  • 385.6k

Multi Form, Multi Tables: What would be the best way to update the tables?

Mar 21 2010 2:31 PM

Hello:

 I have around 50 tables and forms, with around 30 fields per table/form. I will need to do Read/Insert/Update the tables.

 Instead of writing code as below (sample), is there a simpler way? As below, I might have to add 90+ lines in the programs and might have to be re-used in some other programs, if needed.

Note: I might have some mistakes in the code below, but I hope you get the idea.

----------------------------------------------------------------------------------------------------------------------------

 

READ:

 

SELECT Fields01, Fields02, Field03...Field30 FROM Table WHERE Field1 = '12345'

textBox01.Text = ReadRecord["Field01"].ToString();

textBox01.Text = ReadRecord["Field02"].ToString();

textBox01.Text = ReadRecord["Field03"].ToString();

...

textBox01.Text = ReadRecord["Field30"].ToString();

 

----------------------------------------------------------------------------------------------------------------------------

UPDATE:

 

SELECT Fields01, Fields02, Field03...Field30 FROM Table WHERE Field1 = '12345'

textBox01.Text = ReadRecord["Field01"].ToString();

textBox01.Text = ReadRecord["Field02"].ToString();

textBox01.Text = ReadRecord["Field03"].ToString();

...

textBox01.Text = ReadRecord["Field30"].ToString();

 

Then.... Entry of fields in form... Then...

 

UPDATE  Table SET Field01 = textBox01.Text , Field02 = textBox02.Text, Field03= textBox02.Text...Field30= textBox30.Text

 

 

----------------------------------------------------------------------------------------------------------------------------

 

INSERT :

 

textBox01.Text = "";

textBox02.Text = "";

textBox03.Text = "";

...

textBox30.Text = "";

 

Then.... Entry of fields in form... Then...

 

INSERT  Table (Field01, Field02, Field03...Field30) VALUES (textBox01.Text, textBox02.Text, textBox03.Text... textBox30.Text)


Answers (26)