Abdalla Elawad

Abdalla Elawad

  • NA
  • 1k
  • 204.7k

how to convert the Nvarchar to Integer with Select c#

Nov 10 2019 4:04 AM
please help me  and look to this code
  1. string mainconn = ConfigurationManager.ConnectionStrings["Con_VisitorsControl"].ConnectionString;  
  2. SqlConnection sqlconn = new SqlConnection(mainconn);  
  3. string sqlquery = "select VisitorName, IqamaCopy from [dbo].[tbl_Visitors] where VisitorId = ' " + txtno.Text + " ' ";  
  4. SqlCommand sqlcomm = new SqlCommand(sqlquery, sqlconn);  
  5. sqlconn.Open();  
  6. SqlDataAdapter sda = new SqlDataAdapter();  
  7. sda.SelectCommand = sqlcomm;  
  8. DataSet ds = new DataSet();  
  9. sda.Fill(ds);  
  10. DataList1.DataSource = ds;  
  11. DataList1.DataBind();  
  12. sqlconn.Close();   
this VisitorId Is Nvarchar contain to 9 digits on sql how can i select and convert this fieldname in the c#
 
thanks 
 

Answers (4)