Abdalla Elawad

Abdalla Elawad

  • NA
  • 1k
  • 215k

how can i search by Nvarchar(10) as integer number c#

Nov 12 2019 1:33 AM
hi
 
hello Programmers i faced a brolem in searching events becaues i used filed contains to 10 digits as nvarchar i will attache code and table to explain more this problem .
 
Soory System faced problem to upload file  , generally this is code below 
 
IqamaNo is Nvarchar(10) contains to 10 digits how to search by by this type of datatype , if i need to convert to this type please help me how can i convert it .
 
thanks 
 
string mainconn = ConfigurationManager.ConnectionStrings["Con_VisitorsControl"].ConnectionString;
SqlConnection sqlconn = new SqlConnection(mainconn);
string sqlquery = "select VisitorName, IqamaCopy from [dbo].[tbl_Visitors] where IqamaNo= ' " + txtno.Text + " ' ";
SqlCommand sqlcomm = new SqlCommand(sqlquery, sqlconn);
sqlconn.Open();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = sqlcomm;
DataSet ds = new DataSet();
sda.Fill(ds);
DataList1.DataSource = ds;
DataList1.DataBind();
sqlconn.Close();
 
 
 
 

Answers (4)