I am not geting any error, It workd well on local machine.. but not on server.
Here Is the code : (I am using 3 tire architecture so my insertion code in database.cs)
Insert page.cs
=============
Database db = new Database();
string str;
str = "insert into ABDatabase(MembershipID,CompanyName,BusinessCategory,ContactPerson,UserName,Password,Address,Area,City,PinCode,State,Phone,Mobile,Email,Website,Description,U_Admin) values (" + Convert.ToInt16(DropDownList2.SelectedItem.Value) + ",'" + txtName.Text + "','" + txtBusinessCategory1.Text + "','" + txtContactPerson.Text + "','" + txtUserName0.Text + "','" + txtPassword0.Text + "','" + txtAddress0.Text + "','" + DropDownList1.SelectedItem.Text + "','" + txtCity.Text + "','" + txtPinCode0.Text + "','" + txtState.Text + "','" + txtPhone0.Text + "','" + txtMobile0.Text + "','" + txtEmail0.Text + "','" + txtWebsite0.Text + "','" + txtDescription0.Text + "','" + Session["AdminUserName"].ToString() + "')";
db.ExecuteNonQuery1(str);
lblmsg0.Text = "Record inserted successfully";
--------------------------------------------------------------------------------------------------------------
Database.cs
public int ExecuteNonQuery1(string str)
{
String _ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["dbConstr"].ConnectionString;
SqlConnection myConnection = new SqlConnection(_ConnString);
SqlCommand cmd = new SqlCommand(str, myConnection);
int result = 0;
try
{
myConnection.Open();
result =cmd.ExecuteNonQuery();
myConnection.Close();
}
catch (Exception ex)
{
result = -1;
try
{
if (myConnection.State == ConnectionState.Open)
{
myConnection.Close();
}
}
catch (Exception ex2)
{
if (myConnection.State == ConnectionState.Open)
myConnection.Close();
}
}
return result;
}
-Neer