hi igot error in parameter [Resolved]

Posted by reddysankark-13471 under C# on 8/5/2012 | Points: 10 | Views : 634 | Status : [Member] | Replies : 2
hi i got error in below
public static DataSet getAllStatesByCountryID(int CountryID)
{
SqlParameter parameter = new SqlParameter("@CountryID", SqlDbType.Int)
{
Value = CountryID
};
return SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure,
"spGetAllStatesByCountryID", new SqlParameter[] { parameter });
}
its showing error in ;excepted near the CountryID

sankarreddy


Responses

Posted by: Gopesh9 on: 8/6/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
You can try like this.....I thnk it will not give an error.

SqlParameter parameter = new SqlParameter("@CountryID", SqlDbType.Int) ;
parameter.value = CountryID;


G. S.
.Net Developer

reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/6/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Try this
    public static DataSet getAllStatesByCountryID(int CountryID)

{
SqlCommand sqlcmd = new SqlCommand();
sqlcmd.Parameters.Add(new SqlParameter("@CountryID", SqlDbType.Int)).Value = CountryID;
return SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(),
CommandType.StoredProcedure, "spGetAllStatesByCountryID", new SqlParameter[] { parameter });
}


reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response