hi i am working on school assignment which is due real soon. but i seem to have an error that ssays sytax error near '=' at line 39. here's my code. i hope someone would point out whats not right with it.
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;
using System.Data;
public partial class Lab_11_2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
SqlConnection conn = new SqlConnection("Data Source=localhost;" +
"Initial Catalog=StudentInfo; Integrated Security= SSPI");
SqlCommand cmdEng_Dip = new SqlCommand("SELECT * FROM whereEng_Dip = @Eng_Dip", conn);
conn.Open();
SqlDataReader dr;
dr = cmdEng_Dip.ExecuteReader();
ddCourseName.DataTextField = "Course_Name";
ddCourseName.DataBind();
dr.Close();
conn.Close();
}
}
protected void ddCourseName_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source=localhost;" +
"Initial Catalog=StudentInfo; Integrated Security= SSPI");
string mySQL;
mySQL = "SELECT * from Eng_Dip = @par_Course_Name";
SqlCommand cmdDipInfo = new SqlCommand(mySQL, conn);
cmdDipInfo.Parameters.AddWithValue("@par_Course_Name", ddCourseName.SelectedItem.Text);
conn.Open();
SqlDataReader dr;
dr = cmdDipInfo.ExecuteReader();
if (dr.Read())
{
txtCourseCode.Text = dr["Course_Code"].ToString();
txtCourseDesc.Text = dr["Course_Desc"].ToString();
}
dr.Close();
conn.Close();
}
}