Click here to Skip to main content
15,885,189 members
Home / Discussions / Database
   

Database

 
GeneralRe: Introduce integerity in the database Pin
jschell9-Jul-12 12:26
jschell9-Jul-12 12:26 
AnswerRe: Introduce integerity in the database Pin
Jörgen Andersson9-Jul-12 19:52
professionalJörgen Andersson9-Jul-12 19:52 
GeneralRe: Introduce integerity in the database Pin
R. Giskard Reventlov9-Jul-12 5:17
R. Giskard Reventlov9-Jul-12 5:17 
QuestionRe: Introduce integerity in the database Pin
Eddy Vluggen9-Jul-12 12:52
professionalEddy Vluggen9-Jul-12 12:52 
AnswerRe: Introduce integerity in the database Pin
R. Giskard Reventlov10-Jul-12 12:05
R. Giskard Reventlov10-Jul-12 12:05 
GeneralRe: Introduce integerity in the database Pin
PIEBALDconsult9-Jul-12 10:54
mvePIEBALDconsult9-Jul-12 10:54 
AnswerRe: Introduce integerity in the database Pin
Eddy Vluggen9-Jul-12 12:51
professionalEddy Vluggen9-Jul-12 12:51 
Questionwhy (Object reference not set to an instance of an object)?! Pin
Jassim Rahma8-Jul-12 21:48
Jassim Rahma8-Jul-12 21:48 
I am getting the above error when I upload my website to host but it's working perfectly on my local PC although both are connected to the same database!

here is the error followed by the code:

Object reference not set to an instance of an object

[NullReferenceException: Object reference not set to an instance of an object.]
   rmconline.salary_slip.btnGenerate_Click(Object sender, EventArgs e) in C:\Users\Jassim\documents\visual studio 2010\Projects\rmconline\rmconline\salary_slip.ascx.cs:70
   DevExpress.Web.ASPxEditors.ASPxButton.OnClick(EventArgs e) +96
   DevExpress.Web.ASPxEditors.ASPxButton.RaisePostBackEvent(String eventArgument) +540
   DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

and here is my code:

C#
protected void btnGenerate_Click(object sender, EventArgs e)
{
    sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
    sql_connection.Open();
    sql_command = new MySqlCommand("sp_get_salary_slip", sql_connection);
    sql_command.CommandType = CommandType.StoredProcedure;
    sql_command.Parameters.Add("param_employee_number", MySqlDbType.Int32).Value = Convert.ToInt32(Session["employee_number"]);
    sql_command.Parameters.Add("param_salary_slip_month", MySqlDbType.Int32).Value = Convert.ToInt32(cboMonth.Value);
    sql_command.Parameters.Add("param_salary_slip_year", MySqlDbType.Int32).Value = Convert.ToInt32(txtYear.Value);
    sql_command.Parameters.AddWithValue("param_is_exist", MySqlDbType.Bit).Direction = ParameterDirection.Output;
    sql_reader = sql_command.ExecuteReader();
    sql_reader.Read();

    if (sql_reader.HasRows)
    {
        lblMonth.Text = String.Format("{0} {1:0000}", cboMonth.Text, txtYear.Value);
        lblSalary.Text = "BD " + Convert.ToDouble(sql_reader["salary_slip_salary"]).ToString("#,###,##0.000");

        panelNoSalarySlip.Visible = false;
        panelSalarySlip.Visible = true;

        sql_connection.Close();

        populate_salary_slip_details();
    }
    else
    {
        panelSalarySlip.Visible = false;
        panelNoSalarySlip.Visible = true;
    }
}

private void populate_salary_slip_details()
{
    data_table = new DataTable();

    sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
    sql_connection.Open();
    sql_command = new MySqlCommand("sp_populate_salary_slip_details", sql_connection);
    sql_command.CommandType = CommandType.StoredProcedure;
    sql_command.Parameters.Add("param_employee_number", MySqlDbType.Int32).Value = Convert.ToInt32(Session["employee_number"]);
    sql_command.Parameters.Add("param_salary_slip_month", MySqlDbType.Int32).Value = Convert.ToInt32(cboMonth.Value);
    sql_command.Parameters.Add("param_salary_slip_year", MySqlDbType.Int32).Value = Convert.ToInt32(txtYear.Value);
    sql_adapter = new MySqlDataAdapter(sql_command);
    sql_adapter.Fill(data_table);
    dataSalarySlip.DataSource = data_table;
    dataSalarySlip.DataBind();
}

AnswerRe: why (Object reference not set to an instance of an object)?! Pin
Simon_Whale9-Jul-12 4:24
Simon_Whale9-Jul-12 4:24 
AnswerRe: why (Object reference not set to an instance of an object)?! Pin
Luc Pattyn9-Jul-12 13:06
sitebuilderLuc Pattyn9-Jul-12 13:06 
Questionupdate table structures from another server Pin
Jassim Rahma8-Jul-12 20:37
Jassim Rahma8-Jul-12 20:37 
AnswerRe: update table structures from another server Pin
Wayne Gaylard8-Jul-12 21:27
professionalWayne Gaylard8-Jul-12 21:27 
Questiontransfer mysql proceedures Pin
Jassim Rahma8-Jul-12 20:35
Jassim Rahma8-Jul-12 20:35 
QuestionError can not attach a database with the same name? Pin
Member 24584675-Jul-12 18:18
Member 24584675-Jul-12 18:18 
AnswerRe: Error can not attach a database with the same name? Pin
Midnight Ahri5-Jul-12 22:21
Midnight Ahri5-Jul-12 22:21 
GeneralRe: Error can not attach a database with the same name? Pin
Member 24584678-Jul-12 18:32
Member 24584678-Jul-12 18:32 
AnswerRe: Error can not attach a database with the same name? Pin
Mycroft Holmes5-Jul-12 23:37
professionalMycroft Holmes5-Jul-12 23:37 
QuestionCopy stored procedures to another database why not? Pin
Member 24584675-Jul-12 17:34
Member 24584675-Jul-12 17:34 
AnswerRe: Copy stored procedures to another database why not? PinPopular
Mycroft Holmes5-Jul-12 17:52
professionalMycroft Holmes5-Jul-12 17:52 
GeneralRe: Copy stored procedures to another database why not? Pin
Member 24584679-Jul-12 18:08
Member 24584679-Jul-12 18:08 
GeneralRe: Copy stored procedures to another database why not? Pin
Mycroft Holmes9-Jul-12 19:13
professionalMycroft Holmes9-Jul-12 19:13 
Generalerror during update openquery Pin
mikcutu5-Jul-12 4:40
mikcutu5-Jul-12 4:40 
GeneralRe: error during update openquery Pin
Eddy Vluggen8-Jul-12 0:21
professionalEddy Vluggen8-Jul-12 0:21 
GeneralRe: error during update openquery Pin
mikcutu9-Jul-12 5:49
mikcutu9-Jul-12 5:49 
Questionintegrate data of some DB into ome, how to? Pin
hs_rostami2-Jul-12 21:31
hs_rostami2-Jul-12 21:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.