Wednesday, August 8, 2007

Getting Closer to the Answer

OK, So I started experimenting in the code. I tried intentinally entering the wrong field number in each line of the code to see what the program was reading and to force it to blow up. The results were educational. I found that

line1 DataFile="~/App_Data/PhoneList.mdb" DeleteCommand="DELETE FROM [PhoneListTable] WHERE [ID] = ? AND [FirstName] = ? AND [LastName] = ? AND [ShowInPhoneList] = ?"
line 2InsertCommand="INSERT INTO [PhoneListTable] ([ID], [FirstName], [LastName], [ShowInPhoneList]) VALUES (?, ?, ?, ?)"
line 3 OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [ID], [FirstName], [LastName], [ShowInPhoneList] FROM [PhoneListTable]"
UpdateCommand="UPDATE [PhoneListTable] SET [FirstName] = ?, [LastName] = ?, [ShowInPhoneList] = ? WHERE [ID] = ?">

If you notice at the end of line 3 if I enter a value for WHERE [ID] = ? and make it WHERE [ID] = 2 then when I do an edit and change the data for that record and then click on UPDATE it updates the record that has the [ID] = 2. Even if I click on record [ID] = 1 it still updates record 2. So I now know it is not a permissions problem but a code problem. I also now know that I can make it work but I just have to figure out how to pass the variable that I click on into the [ID] = ?

Watch for future post.

No comments: