[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Inserting a row into a dataset using tableadapter.insert

Posted on 2006-04-03
4
Medium Priority
?
256 Views
Last Modified: 2013-12-25
               Try
                    LastticketNo += 1
                    MessageBox.Show(LastticketNo)
                    If Me.OutClass.Text = "Economy" Then
                        classtype = "Y"
                    Else : classtype = "C"
                    End If
                    ticketingTableAdapter.Insert(PNRNO, Integer.Parse(LastticketNo), Me.TitleCombo1.SelectedItem,     Me.FirstNameBox1.Text, Me.SurnameBox1.Text _
                    , Me.PassportBox1.Text, Me.OutFlightNo.Text, (CType(RSdepartDate.Text, Date)), True, classtype, "Tony", Date.Now)

 MessageBox.Show("ticket insert 1 ok")
                Catch ex As Exception
                    MessageBox.Show("Ticket 1 failed")
                End Try

this piece of code doesnt work for me.. no idea what is wrong with it.... NEED HELP badly guys..  it keeps giveing ticket 1 failed

is the date diclared well ((CType(RSdepartDate.Text, Date)),) not sure about that...

Basicly this is an airline reservation system,
0
Comment
Question by:aborg85
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16363869
Put a breakpoint in your Catch block and see what the actual exception is.
0
 

Author Comment

by:aborg85
ID: 16364120
Thanks for your response.

Can you suggest me some code to do the breakpoint pls.

Thanks
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 1500 total points
ID: 16364160
Well, to start just add the following line into your catch block:

    MessageBox.Show(ex.message)
0
 

Author Comment

by:aborg85
ID: 16365744
Thanks Carl_tawn,

that simple little line of code, helped me find my prob...

Thanks again
Until next time.... which wont be far away
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question