Hi all,
i have this code below how to to correct it , i dont kno what to write in the location which i mentioned inside the code,
i want to keep the blok conction string region as its ...
A local variable named 'cmd' is already defined in this scope
The best overloaded method match for 'System.Data.SqlClient.SqlCommand.SqlCommand(string)' has some invalid arguments
Argument 1: cannot convert from 'System.Data.SqlClient.SqlConnection' to 'string'
#region Connection
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Test_Connection"].ConnectionString);
#endregion Connection
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable("GVAssetList-dt");
SqlCommand cmd = con.CreateCommand();
SqlCommand cmd = new SqlCommand(con);
cmd.CommandText = "SP_GetAssetList";
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
GVAssetList.DataSource = dt;
GVAssetList.DataBind();
}
regards