Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

error occur when run code execute scalar ?

$
0
0

hello sir  i want to display this code as entity base but execute scalar does not run in this case  an error occur 

i have also comment out the old code where i have tried in this case 

so how they can execute 

cs

public void Fill()
{
using (var ctx = new industryEntities1())
{

var studentName = ctx.tbl_licencel.SqlQuery("select max(user_id)+1 as user_id from tbl_licencel").ToList();
user_id.Text = ctx.ExecuteScalar().ToString();

}

//SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConString"].ConnectionString);
//con.Open();
//SqlCommand cmd = new SqlCommand("select max(user_id)+1 as user_id from tbl_licencel", con);
//user_id.Text = cmd.ExecuteScalar().ToString();
//con.Close();
}


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>