Author: learner11 | Posted on: 12/4/2009 9:39:58 AM | Views : 240

Hi
It would be great if someone can help me out!
Im getting error,when I post data into db.
I have ddlcity control,and if i select city 0Other,one txtbox should appear and post tht value to the 2 tables(city table and Register table).
If im selecting other narmal cities values,all should noramlly posted to Register table.


Here im getting error when I select Other in ddlcity   and while  txtbox values posting to db.
Im getting SQL exception error as "Cannot insert NULL value to the column Country in table City!,Insert fails!!!"
Getting error in CityId = (int)cmd3.ExecuteScalar();


protected void BtnRegister_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["StrConn"]);
conn.Open();
int CityId = 0;
if ((txtOther.Text != "") && (ddlcity.SelectedItem.Text == "Other"))
{
Go to the complete details ...