Click here to Skip to main content
15,943,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
namespace rathana
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack == true)
            {
                populatecombobox();
                txtAmountDisplay();
            }
        }
        private void populatecombobox()
        {
            DataSet Ds;
            Ds = new DataSet();
            SqlCommand Cmd = new SqlCommand();
            SqlDataAdapter Adp = new SqlDataAdapter();
            SqlConnection Cnn = new SqlConnection();
            string ConnectionString;
            Cnn.ConnectionString = @"Data Source=DEVI\SQLEXPRESS; Initial Catalog =photo; Integrated Security=SSPI";
            
            if (Cnn.State != ConnectionState.Open)
                Cnn.Open();
            Cmd.Connection = Cnn;
            Cmd.CommandType = CommandType.StoredProcedure;
            Cmd.CommandText = "UspGetDataFromtblSize";
            Cmd.Parameters.Clear();
            //Cmd.Parameters.AddWithValue("@Id", Id);
            Adp.SelectCommand = Cmd;
            try
            {
                Adp.Fill(Ds);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(
                    "!!! An Error Occured While getting Data From tblSize." + ex.Message);
                lblError.Visible = true;
                lblError.Text = "!!! An Error Occured While " + ex.Message.ToString();
                return;
            }
            if (Ds.Tables[0].Rows.Count > 0)
            {
                cmbSize.DataSource = Ds;
                cmbSize.DataTextField = "Size";
                cmbSize.DataValueField = "SizeID";
                cmbSize.DataBind();
            }
            Cmd.Dispose();
            Cnn.Close();
            Cnn.Dispose();
            return;
        }
        }
        private void txtAmountDisplay()
        {

            Int32 str;
            SqlCommand Cmd = new SqlCommand();
            SqlConnection Cnn = new SqlConnection();
            string ConnectionString;
            Cnn.ConnectionString = @"Data Source=DEVI\SQLEXPRESS; Initial Catalog =photo; Integrated Security=SSPI";
            if (Cnn.State != ConnectionState.Open)
                Cnn.Open();
            Cmd.Connection = Cnn;
            Cmd.CommandType = CommandType.StoredProcedure;
            Cmd.CommandText = "sproc_Ins_RATE_PhotoSettingsDetail";
            Cmd.Parameters.Clear();
            // Cmd.Parameters.AddWithValue("@Id", txtBillNo.Text);
            Cmd.Parameters.AddWithValue("@SizeID", cmbSize.SelectedValue);
            //  Cmd.Parameters.AddWithValue("@Rate", txtAmt.Text.ToString());
            try
            {
                str = Convert.ToInt32(Cmd.ExecuteScalar());
                txtAmt.Text = str.ToString();
            }
            catch (Exception ex)
            {
                throw new ApplicationException(
                    "!!! An Error Occured While getting Data From tblRate." + ex.Message);
                lblError.Visible = true;
                lblError.Text = "!!! An Error Occured While " + ex.Message.ToString();
                return;
            }

            Cmd.Dispose();
            Cnn.Close();
            Cnn.Dispose();
            return;

        }
        protected void cmbSize_SelectedIndexChanged1(object sender, EventArgs e)
        {
            txtAmountDisplay();
            if ((txtAmt.Text != "") && (txtNoofcopies.Text != ""))
            {
                txtTot.Text = Convert.ToString(Convert.ToInt32(txtNoofcopies.Text) * Convert.ToInt32(txtAmt.Text));
                //lblTotal.Text = Convert.ToString(Convert.ToInt32(lblTotal.Text) + Convert.ToInt32(txtTot.Text));
            }
            else
            {
                txtTot.Text = Convert.ToString(0);
                // lblTotal.Text = Convert.ToString(0);
            }

        }
        private DataSet GetData()
        {
            DataSet Ds;
            Ds = new DataSet();
            SqlCommand Cmd = new SqlCommand();
            SqlDataAdapter Adp = new SqlDataAdapter();
            SqlConnection Cnn = new SqlConnection();
            string ConnectionString;
            Cnn.ConnectionString = @"Data Source=DEVI\SQLEXPRESS; Initial Catalog =photo; Integrated Security=SSPI";
            
            if (Cnn.State != ConnectionState.Open)
                Cnn.Open();
            Cmd.Connection = Cnn;
            Cmd.CommandType = CommandType.Text;
            Cmd.CommandText = "select Size,0 as Amount,'' As Noofcopies from tblSize where SizeID=0";
            Cmd.Parameters.Clear();
            //Cmd.Parameters.AddWithValue("@Id", Id);
            Adp.SelectCommand = Cmd;
            try
            {
                Adp.Fill(Ds);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(
                    "!!! An Error Occured While getting Data." + ex.Message);
                //lblErrorMsg.Visible = true;
                //lblErrorMsg.Text = "!!! An Error Occured While " + ex.Message.ToString();
            }
            Cmd.Dispose();
            Cnn.Close();
            Cnn.Dispose();
            return Ds;
        }

        
    }
}
MSIL
Error   1   Expected class, delegate, enum, interface, or struct    C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\rathana\rathana\Default.aspx.cs    74  17  rathana
Error   2   Expected class, delegate, enum, interface, or struct    C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\rathana\rathana\Default.aspx.cs    79  34  rathana
Error   3   Expected class, delegate, enum, interface, or struct    C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\rathana\rathana\Default.aspx.cs    80  37  rathana
Error   4   Expected class, delegate, enum, interface, or struct    C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\rathana\rathana\Default.aspx.cs    102 27  rathana
Error   5   A namespace does not directly contain members such as fields or methods C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\rathana\rathana\Default.aspx.cs    111 13  rathana
Error   6   Type or namespace definition, or end-of-file expected   C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\rathana\rathana\Default.aspx.cs    118 9   rathana
Posted
Updated 4-May-11 22:35pm
v2
Comments
Sandeep Mewara 5-May-11 4:41am    
check the lines where you are getting these error and resolve on by one. Try!

1 solution

You've got an extra } bracket just above 'private void txtAmountDisplay()', remove it.
 
Share this answer
 
Comments
Dalek Dave 5-May-11 5:00am    
Good Spot!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900