Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Input string was not in a correct format

$
0
0

Hi,

in my application sometimes this error is coming  when  i click on newbuttonclick or editbuttonclick .I tried  to pass differetn ways but  it shows  same error .sometimes  in first newbtnclick it shows this error.In database EmpID column int.

String userid;

in pageload if (Request.QueryString["Id"] != null) { userid = Request.QueryString["Id"]; EditControlvalues1(); }



int userid1 = Convert.ToInt32(userid); SqlCommand cmd = new SqlCommand("select EmpName,StartDate,EndDate from EmpTimesheet where EmpId="+@userid1, cn); cmd.Parameters.AddWithValue("@EmpId", userid1); ///it shows error


 //cmd.Parameters.AddWithValue("@EmpId", SqlDbType.Int).Value=userid;
     //   cmd.Parameters.AddWithValue("@EmpId", Convert.ToInt32 (userid));


Viewing all articles
Browse latest Browse all 8428

Trending Articles



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