Solved

Airline 5

Posted on 2012-04-06
5
310 Views
Last Modified: 2012-04-06
Error      2      Newline in constant      C:\Course Technology\CIS Programming\ASP .NET Programming\Data Files\Chapter.09\Chapter\SkywardAviation\Registration.aspx.cs      66      81      C:\...\SkywardAviation\


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack
            && enrollmentForm.ActiveViewIndex == 0)
            hiddenPassword.Value = password.Text;
    }
    protected void Page_LoadComplete(
        object sender, EventArgs e)
    {
        if (Page.IsPostBack
            && enrollmentForm.ActiveViewIndex == 3)
        {
            SqlConnection dbConnection
                = new SqlConnection(
                    "Data Source=.\\SQLEXPRESS; AttachDbFilename=C:\\Course Technology\\CIS Programming\\ASP .NET Programming\\Data Files\\Chapter.09\\Chapter\\SkywardAviation.mdf; Integrated Security=True; User Instance=True");
                   }
        try
        {
            dbConnection.Open();
            SqlCommand sqlCommand = new SqlCommand(
                "INSERT INTO FrequentFlyers (last, first,"
                + " phone, email, password, cardType,"
                + " expireMonth, expireYear, cardnumber,"
                + " cardholder, address, city, state, zip,"
                + " travelerType, homeAirport, class, seat,"
                + " meal) VALUES("
                + "'" + lastName.Text + "',"
                + "'" + firstName.Text + "',"
                + "'" + telephone.Text + "',"
                + "'" + email.Text + "',"
                + "'" + hiddenPassword.Value + "',"
                + "'" + creditcard.Text + "',"
                + "'" + expireMonth.Text + "',"
                + "'" + expireYear.Text + "',"
                + "'" + cardnumber.Text + "',"
                + "'" + cardholder.Text + "',"
                + "'" + address.Text + "',"
                + "'" + city.Text + "',"
                + "'" + state.Text + "',"
                + "'" + zip.Text + "',"
                + "'" + travelerType.Text + "',"
                + "'" + homeAirport.Text + "',"
                + "'" + serviceClass.Text + "',"
                + "'" + seatPreference.Text + "',"
                + "'" + mealRequest.Text + "',)",
                dbConnection);
            sqlCommand.ExecuteNonQuery();
            sqlCommand = new SqlCommand(
                "SELECT IDENT_CURRENT('FrequentFlyers')",
                dbConnection);
            SqlDataReader lastID=
                SqlCommand.ExecuteReader();
            if(lastID.read())
                successString.Text +=
                "<h3>Enrollment Sucessful</h3>
                <p>Your frequent flyer number is " + lastID.GetValue(0) + ".</p>";
        }
       catch (SqlException exception)
       {
            successString.Text += "<p>Error code "
                + exception.Number
                + ": " + exception.Message + "</p>";
}
dbConnection.Close();
       
}
}

Can you help me with this homework?  I have a newline error.  Please provide pointers in how to resolve newline errors!  Thank you!
0
Comment
Question by:assaultkitty
  • 2
  • 2
5 Comments
 
LVL 37

Assisted Solution

by:Neil Russell
Neil Russell earned 250 total points
ID: 37817274
Same as last one. You have a line that has an Opening quote "  but the closing quote is
on another line "

You MUST have both  "  and  " on the same line
0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 250 total points
ID: 37817287
Realize that the author of the code in the book is writing the code properly but the book printer is squeezing the code into a narrow column. If you re-type it exactly as you see it, you will have these problems.
0
 

Author Closing Comment

by:assaultkitty
ID: 37817319
Thank you.  So how does the student really learn with the teacher not being available. this is an online class.  She told me to find some help.
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 37817354
Well, you found it! I don't think much of an online course that tells you to "find some help". If you are paying for it, they should be there to help.

Here at the Expert Exchange is how a student can really learn. I advise people I know who want to learn Web Development on their own to just buy a membership on EE and just start playing around. If any questions arise, post them and experts will trip over each other to answer. Plus, there are tons code examples online. Just Google your situation and it will be there. I personally have ZERO formal training in web development. "That explains a lot" the other experts are now saying to themselves : )
0
 

Author Comment

by:assaultkitty
ID: 37817388
I have some online and some in class training.  The in class training includes SQL and Java along with some web course.  I was really angry with her when I asked her for some help. I still have the message for future references.  Yes I am a paying customer.  If you looked back last week I did not request any help that was because I had a very good SQL teacher.  I was able to complete the SQL portion with problems.  I am sorry for the confusion.  I am will be finished with this course on 30 April.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now