I am working on WEB API. when i am trying to insert data using ADO.NET or Entity Framework. It shows an Error Message "Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014)". but the same code is working on Console Application project.Database Server is at AWS. Code are as below.
SqlConnection con = new SqlConnection(constring);
con.open();
sqlcommand cmd = new sqlcommand();
cmd.Connection = con;
cmd.commandtext = "uspsaveregistration";
cmd.commandtype = commandtype.storedprocedure;
sqlparameter[] sqlp = new sqlparameter[] {
new sqlparameter("@mobile_no",sqldbtype.varchar),
new sqlparameter("@password",sqldbtype.varchar),
new sqlparameter("@first_name",sqldbtype.varchar),
new sqlparameter("@last_name",sqldbtype.varchar),
new sqlparameter("@gender",sqldbtype.varchar),
new sqlparameter("@dob",sqldbtype.varchar),
new sqlparameter("@designation",sqldbtype.varchar),
new sqlparameter("@address",sqldbtype.varchar),
new sqlparameter("@mapid",sqldbtype.int),
new sqlparameter("@createormodified",sqldbtype.bit),
new sqlparameter("@email",sqldbtype.varchar),
new sqlparameter("@mpin",sqldbtype.varchar),
new sqlparameter("@lga_id",sqldbtype.int),
new sqlparameter("@entityid",sqldbtype.varchar),
new sqlparameter("@nownowid",sqldbtype.varchar),
new sqlparameter("@type_code",sqldbtype.int),
new sqlparameter("@beat_code",sqldbtype.varchar),
new sqlparameter("@modify_by",sqldbtype.varchar),
new sqlparameter("@synccount",sqldbtype.int),
new sqlparameter("@isonline",sqldbtype.bit)
};
sqlp[0].value = mobileno;
sqlp[1].value = password;
sqlp[2].value = firstname;
sqlp[3].value = lastname;
sqlp[4].value = gender;
sqlp[5].value = dob;
sqlp[6].value = designation;
sqlp[7].value = address;
sqlp[8].value = mapid;
sqlp[9].value = createormodi;
sqlp[10].value = email;
sqlp[11].value = mpin;
sqlp[12].value = lgaid;
sqlp[13].value = entityid;
sqlp[14].value = nownowid;
sqlp[15].value = typecode;
sqlp[16].value = beatcode;
sqlp[17].value = modifyby;
sqlp[18].value = syncount;
sqlp[19].value = isonline;
foreach (sqlparameter para in sqlp)
{
cmd.parameters.add(para);
}
cmd.executenonquery();
con.close();
User contributions licensed under CC BY-SA 3.0