assaultkitty
asked on
Airline 5
Error 2 Newline in constant C:\Course Technology\CIS Programming\ASP .NET Programming\Data Files\Chapter.09\Chapter\S kywardAvia tion\Regis tration.as px.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.ActiveViewI ndex == 0)
hiddenPassword.Value = password.Text;
}
protected void Page_LoadComplete(
object sender, EventArgs e)
{
if (Page.IsPostBack
&& enrollmentForm.ActiveViewI ndex == 3)
{
SqlConnection dbConnection
= new SqlConnection(
"Data Source=.\\SQLEXPRESS; AttachDbFilename=C:\\Cours e Technology\\CIS Programming\\ASP .NET Programming\\Data Files\\Chapter.09\\Chapter \\SkywardA viation.md f; 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('FrequentFly ers')",
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!
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.ActiveViewI
hiddenPassword.Value = password.Text;
}
protected void Page_LoadComplete(
object sender, EventArgs e)
{
if (Page.IsPostBack
&& enrollmentForm.ActiveViewI
{
SqlConnection dbConnection
= new SqlConnection(
"Data Source=.\\SQLEXPRESS; AttachDbFilename=C:\\Cours
}
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('FrequentFly
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!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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 : )
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 : )
ASKER
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.
ASKER