Jyoti Jodha

Jyoti Jodha

  • NA
  • 1.7k
  • 405.8k

cannot implicitly convert type 'string' to 'int' in c#

Apr 11 2017 1:02 AM
cannot implicitly convert type 'string' to 'int' in c# Windows Application
 
private int billno(string p)
{
string Billno = "0";
cmd = new SqlCommand(p, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
Billno = reader[0].ToString();
}
reader.Close();
return Billno;
con.Close();
}
 
private void btn_Insert_Click(object sender, EventArgs e)
{
int Billno = billno("Select ISNULL(Max(Billno+1),1) From MainBillForm");
}
 
 

Answers (12)