General discussion

  • Creator
  • #2257423

    Data table giving me a migraine


    by ydobonmai ·

    I want to combine three tables of my database in one page and on submit want to update all three tables at the same time. Same goes for Edit and Delete. I am unable to do it. I am using a dataset and if i select columns from all three tables then it does display it but will not delete or do any other operations on it. It gives me a application error. This problem does not occur if i use just 1 table. with 3 tables it does not autogenerate the insert, delete and edit statements but the funny thing is that it displays it all right.
    the code is below:

    SELECT Students.Student_ID, Students.Salutation, Students.First_Name, Students.Last_Name, Students.Fathers_Name, Students.DOB, Students.Gender,
    Students.Nationality, Students.Caste, Students.Blood_Group, Students.DOR, Student_Address.SL_No, Student_Address.Student_ID AS Expr1,
    Student_Address.Address, Student_Address.City, Student_Address.Pincode, Student_Address.State, Student_Address.Country,
    Student_Address.Country_Code1, Student_Address.State_Code1, Student_Address.Phone1, Student_Address.Country_Code2,
    Student_Address.State_Code2, Student_Address.Phone2, Student_Address.Country_Code_Mob, Student_Address.State_Code_Mob,
    Student_Address.Mobile, Student_Address.Country_Code_Fax, Student_Address.State_Code_Fax, Student_Address.Fax, Student_Address.Email,
    Student_Details.SL_No AS Expr2, Student_Details.Student_ID AS Expr3, Student_Details.LAC_Board, Student_Details.LAC_Institution,
    Student_Details.Aggregate_PCB, Student_Details.Passport_No, Student_Details.PP_DOI, Student_Details.PP_DOE
    FROM Students INNER JOIN
    Student_Address ON Students.Student_ID = Student_Address.Student_ID INNER JOIN
    Student_Details ON Students.Student_ID = Student_Details.Student_ID

    Can someone please help me out.

All Comments

  • Author
    • #3202042

      Reply To: Data table giving me a migraine

      by ziqbalbh ·

      In reply to Data table giving me a migraine

      You can not do that in one go unless you create your own stored procedure for update, delete and insert.

      A dataset is populated using dataadapter, which inturn uses its select command to retrieve results. When a dataset is saved using dataadapter, you need to update, insert, and delete command as required by your functionality.

      It seems from your question that you had autogenerated these commands through wizard. That wizard would only generate other than select command if that command could be atomic, or simply on one table. Unless you specify your own procedures for these commands.

      Hope this could clear some issues for you.

    • #3166696

      Reply To: Data table giving me a migraine

      by ydobonmai ·

      In reply to Data table giving me a migraine

      yeah i know…that’s what it seemed to me.

      So i wen ahead and created additional queries for insert and update. Seems to be working fine now.

      Btw, this wierd thing, VS2005 drove me mad as i was unable to reference a particular textbox on a form view control.

      i.e To access a textbox on a page i would just type “strTest = TextBox1.Text”

      The formview control though doesn’t let me do this.

      In ASP/HTML this was never a problem.

      Any Ideas??

      I’m new to this. any help is apprieciated.

    • #3283919

      Reply To: Data table giving me a migraine

      by leirags ·

      In reply to Data table giving me a migraine

      First at all, you need know the precedence of tables, i guest that:

      First- Student need exist before you can add on other tables (Student_Address , Student_Details)

      Then if you need add a new student,

      Insert on “Students”

      Then Insert on Student_Address , Student_Details.

      The PK are (i guess) Student_ID.

      If you need update make a update on same way.

Viewing 2 reply threads