am using asp.net 3.5(c#) + sql server 200 DB,
doing this GIVES me an error ,
Error:The multi-part identifier "email@yahoo.com" could not be bound
why ???
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class advertisementSubmission : System.Web.UI.Page
{
protected String EmplyrSession;
protected void Page_Load(object sender, EventArgs e)
{
EmplyrSession = (String) Session["UserEmail"];
Response.Write(EmplyrSession);
String conString = "Data Source=COSANOSTRA;Initial Catalog=Waleed_orsfinal;Integrated Security=True";
//Sql Connection
SqlConnection con = new SqlConnection(conString);
//Sql Command
String query = "select userid from tblUser where email=" + EmplyrSession;
SqlCommand com = new SqlCommand(query, con);
try
{
con.Open();
com.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write("Error:" + ex.Message);
}
finally
{
con.Close();
}
//Sql DataAdapter
//SqlDataAdapter da = new SqlDataAdapter(com);
////Sql DataSet
//DataSet ds = new DataSet();
//da.Fill(ds, "tblJobAdv");
////Filling DetailsView
//DetailsViewAdvSubmission.DataSource = ds;
//DetailsViewAdvSubmission.DataBind();
int jbid = int.Parse( Request.QueryString["jbid"]);
Response.Write(jbid);
}
}