sending my data from a form back to my database  
Author Message
thinkhard





PostPosted: .NET Framework Data Access and Storage, sending my data from a form back to my database Top

Currently the app I have has a access database setup as a datasource, and I have a form to fill out reports and send it back to the database to be stored.

The user is suppose to press a button and have the database updated, the code I used was found in several help topics:

Private Sub ReportBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReportBindingNavigatorSaveItem.Click

Try

Me.Validate()

Me.ReportBindingSource.EndEdit()

Me.ReportTableAdapter.Update(Me.IndivstoreDataSet.Report)

MsgBox("Update successful")

Catch ex As Exception

MsgBox("Update failed")

End Try

I get the msgbox saying update successful but when i check the database there is no record. i can't tell if the code for updating the database is wrong or if maybe i have some property of the dataset incorrect.

I would appreaciate anyadvice you could give.



.NET Development5  
 
 
Damiaan





PostPosted: .NET Framework Data Access and Storage, sending my data from a form back to my database Top

Are the controls on the form bound to the same dataset

Look at the Databinding properties.


 
 
Paul Domag





PostPosted: .NET Framework Data Access and Storage, sending my data from a form back to my database Top

Hi,

Also, check if ReportTableAdapter contains the right UPDATE, INSERT and DELETE statements.

cheers,

Paul June A. Domag



 
 
thinkhard





PostPosted: .NET Framework Data Access and Storage, sending my data from a form back to my database Top

the statment for updating the table adapter is:

UPDATE Report
SET [Incident Report Number] = , [Incident Date] = , [Incident Time] = , [Incident Location] = , [Subects Last Name] = , [Subjects First Name] = ,
[Subjects Middle Name] = , [Government ID#] = , [ID State] = , [Desription of Vechile] = , [Vechile Plate Number] = , [Phone Number] = ,
[Subjects Address] = , City = , State = , Zip = , [Incident Type] = , [Ammount Of Incident] = , [Action(s) Taken] = , [Reason For Action] = ,
[LP Officer] = , [Police Report] = , [Responding Officer] = , [Detailed Description] = , Accomplices = , [Subjects Date of Birth] = , Height = ,
Weight = , Race = , [Hair Color] = , [Eye Color] = , Glasses = , [Store Incident Number] =
WHERE ([Incident Report Number] = ) AND ( = 1 AND [Store Incident Number] IS NULL OR
[Store Incident Number] = ) AND ( = 1 AND [Incident Date] IS NULL OR
[Incident Date] = ) AND ( = 1 AND [Incident Time] IS NULL OR
[Incident Time] = ) AND ( = 1 AND [Incident Location] IS NULL OR
[Incident Location] = ) AND ( = 1 AND [Subects Last Name] IS NULL OR
[Subects Last Name] = ) AND ( = 1 AND [Subjects First Name] IS NULL OR
[Subjects First Name] = ) AND ( = 1 AND [Subjects Middle Name] IS NULL OR
[Subjects Middle Name] = ) AND ( = 1 AND [Government ID#] IS NULL OR
[Government ID#] = ) AND ( = 1 AND [ID State] IS NULL OR
[ID State] = ) AND ( = 1 AND [Desription of Vechile] IS NULL OR
[Desription of Vechile] = ) AND ( = 1 AND [Vechile Plate Number] IS NULL OR
[Vechile Plate Number] = ) AND ( = 1 AND [Phone Number] IS NULL OR
[Phone Number] = ) AND ( = 1 AND [Subjects Address] IS NULL OR
[Subjects Address] = ) AND ( = 1 AND City IS NULL OR
City = ) AND ( = 1 AND State IS NULL OR
State = ) AND ( = 1 AND Zip IS NULL OR
Zip = ) AND ( = 1 AND [Incident Type] IS NULL OR
[Incident Type] = ) AND ( = 1 AND [Ammount Of Incident] IS NULL OR
[Ammount Of Incident] = ) AND ( = 1 AND [Action(s) Taken] IS NULL OR
[Action(s) Taken] = ) AND ( = 1 AND [Reason For Action] IS NULL OR
[Reason For Action] = ) AND ( = 1 AND [LP Officer] IS NULL OR
[LP Officer] = ) AND ( = 1 AND [Police Report] IS NULL OR
[Police Report] = ) AND ( = 1 AND [Responding Officer] IS NULL OR
[Responding Officer] = ) AND ( = 1 AND [Detailed Description] IS NULL OR
[Detailed Description] = ) AND ( = 1 AND Accomplices IS NULL OR
Accomplices = ) AND ( = 1 AND [Subjects Date of Birth] IS NULL OR
[Subjects Date of Birth] = ) AND ( = 1 AND Height IS NULL OR
Height = ) AND ( = 1 AND Weight IS NULL OR
Weight = ) AND ( = 1 AND Race IS NULL OR
Race = ) AND ( = 1 AND [Hair Color] IS NULL OR
[Hair Color] = ) AND ( = 1 AND [Eye Color] IS NULL OR
[Eye Color] = ) AND ( = 1 AND Gla
sses IS NULL OR
Glasses = )

Is that the statment you were refering to