TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
515
46.4k
About ADO.Net MVC
Feb 11 2021 7:23 AM
Hello everyone
thank you for your helpp
I also had the same issue with Inserting to DB, but it got fixed by arranging column order.
So I am using same order to update the table, but nothing is happening.
Now with same parameters and same column order, I am updating the data, but it is keeps on loading and nothing happens. Following is the Update code. Please let me know what I'm missing here.
string query = "UPDATE drug_details SET name=@name,label=@label, price=@price, quantity=@quantity,image=@image, description=@description, counselling=@counselling,ndc=@ndc, dosage=@dosage, brand=@brand, drug_form_id=@drug_form_id, drug_category_id=@drug_category_id, drug_class_id=@drug_class_id,drug_type_id=@drug_type_id, age_group_id=@age_group_id, contradiction=@contradiction,administration=@administration, missed_dose=@missed_dose, interaction=@interaction,monitoring=@monitoring, side_effects=@side_effects, storage=@storage,refillable=@refillable, refill_limit=@refill_limit,tier_one=@tier_one,tier_two=@tier_two,tier_three=@tier_three,tier_four=@tier_four,tier_five=@tier_five,erx_required=@erx_required,active=@active,created_at=@created_at,updated_at=@updated_at,min_quantity=@min_quantity,max_quantity=@max_quantity,qty_allowed=@qty_allowed where id=@id";
string constr = ConfigurationManager.ConnectionStrings["cs"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand(query))
{
cmd.Parameters.AddWithValue("@id",Convert.ToInt32(Session["DrugIdAtEdit"].ToString()));
cmd.Parameters.AddWithValue("@name", txtname);
cmd.Parameters.AddWithValue("@label", txtlabelname);
cmd.Parameters.AddWithValue("@price", txtprice);
cmd.Parameters.AddWithValue("@quantity", txtquantity);
cmd.Parameters.AddWithValue("@image", filename);
cmd.Parameters.AddWithValue("@description", s.description);
cmd.Parameters.AddWithValue("@counselling", s.counselling);
cmd.Parameters.AddWithValue("@ndc", txtndc);
cmd.Parameters.AddWithValue("@dosage", txtdosage);
cmd.Parameters.AddWithValue("@brand", Convert.ToBoolean(1));
cmd.Parameters.AddWithValue("@drug_form_id", ddldrugform);
cmd.Parameters.AddWithValue("@drug_category_id", ddldrugcategory);
cmd.Parameters.AddWithValue("@drug_class_id", ddldrugclass);
cmd.Parameters.AddWithValue("@drug_type_id", ddldrugtype);
cmd.Parameters.AddWithValue("@age_group_id", ddlagegroup);
cmd.Parameters.AddWithValue("@contradiction", s.contradiction);
cmd.Parameters.AddWithValue("@administration", s.administration);
cmd.Parameters.AddWithValue("@missed_dose", s.missed_dose);
cmd.Parameters.AddWithValue("@interaction", s.interaction);
cmd.Parameters.AddWithValue("@monitoring", s.monitoring);
cmd.Parameters.AddWithValue("@side_effects", s.side_effects);
cmd.Parameters.AddWithValue("@storage", s.storage);
cmd.Parameters.AddWithValue("@refillable", ddlrefillallowed);
cmd.Parameters.AddWithValue("@refill_limit", txtrefills);
cmd.Parameters.AddWithValue("@tier_one", txttierone);
cmd.Parameters.AddWithValue("@tier_two", txttiertwo);
cmd.Parameters.AddWithValue("@tier_three", txttierthree);
cmd.Parameters.AddWithValue("@tier_four", txttierfour);
cmd.Parameters.AddWithValue("@tier_five", txttierfive);
cmd.Parameters.AddWithValue("@erx_required", ddlerxrequired);
cmd.Parameters.AddWithValue("@active", Convert.ToBoolean(1));
cmd.Parameters.AddWithValue("@created_at", s.created_at);
cmd.Parameters.AddWithValue("@updated_at", DateTime.Now);
cmd.Parameters.AddWithValue("@min_quantity", txtminquantity);
cmd.Parameters.AddWithValue("@max_quantity", txtmaxquantity);
cmd.Parameters.AddWithValue("@qty_allowed", Convert.ToBoolean(1));
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
Reply
Answers (
6
)
Authentication with Azure AD with SQL database sync
Httpclient call not hitting 2nd api solution but hitting in controller