Click here to Skip to main content
15,914,071 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error: Calling C++ dll function in C# Pin
taibc23-Oct-12 17:44
taibc23-Oct-12 17:44 
AnswerRe: Error: Calling C++ dll function in C# Pin
taibc22-Oct-12 23:04
taibc22-Oct-12 23:04 
GeneralRe: Error: Calling C++ dll function in C# Pin
mphill474423-Oct-12 7:10
mphill474423-Oct-12 7:10 
GeneralRe: Error: Calling C++ dll function in C# Pin
taibc23-Oct-12 17:07
taibc23-Oct-12 17:07 
Questionsmall IRC Based command shell Pin
seangroves21-Oct-12 13:42
seangroves21-Oct-12 13:42 
AnswerRe: small IRC Based command shell Pin
Richard MacCutchan21-Oct-12 21:54
mveRichard MacCutchan21-Oct-12 21:54 
Questionelse if statement vs switch statement Pin
DeAd_HeAd21-Oct-12 12:18
DeAd_HeAd21-Oct-12 12:18 
AnswerRe: else if statement vs switch statement Pin
Richard Andrew x6421-Oct-12 14:52
professionalRichard Andrew x6421-Oct-12 14:52 
GeneralRe: else if statement vs switch statement Pin
DeAd_HeAd21-Oct-12 16:07
DeAd_HeAd21-Oct-12 16:07 
GeneralRe: else if statement vs switch statement Pin
Richard Andrew x6421-Oct-12 16:17
professionalRichard Andrew x6421-Oct-12 16:17 
GeneralRe: else if statement vs switch statement Pin
Richard Deeming22-Oct-12 2:05
mveRichard Deeming22-Oct-12 2:05 
JokeRe: else if statement vs switch statement Pin
BobJanova22-Oct-12 4:24
BobJanova22-Oct-12 4:24 
AnswerRe: else if statement vs switch statement Pin
Abhinav S21-Oct-12 17:47
Abhinav S21-Oct-12 17:47 
AnswerRe: else if statement vs switch statement Pin
Kevin Bewley21-Oct-12 23:34
Kevin Bewley21-Oct-12 23:34 
GeneralRe: else if statement vs switch statement Pin
BobJanova22-Oct-12 4:24
BobJanova22-Oct-12 4:24 
Questionparameter comments for a method wont work fine Pin
mohammadkaab21-Oct-12 8:28
mohammadkaab21-Oct-12 8:28 
AnswerRe: parameter comments for a method wont work fine Pin
Eddy Vluggen21-Oct-12 22:17
professionalEddy Vluggen21-Oct-12 22:17 
GeneralRe: parameter comments for a method wont work fine Pin
mohammadkaab22-Oct-12 0:34
mohammadkaab22-Oct-12 0:34 
GeneralRe: parameter comments for a method wont work fine Pin
Eddy Vluggen22-Oct-12 0:52
professionalEddy Vluggen22-Oct-12 0:52 
Questionwhat does this error mean? Pin
Member 939900720-Oct-12 18:33
Member 939900720-Oct-12 18:33 
AnswerRe: what does this error mean? Pin
Brisingr Aerowing20-Oct-12 19:16
professionalBrisingr Aerowing20-Oct-12 19:16 
Questionhow I can make the intranet developed in c # to connect to several database in SQL Server 2008 R2 Pin
jaime durand20-Oct-12 18:28
professionaljaime durand20-Oct-12 18:28 
AnswerRe: how I can make the intranet developed in c # to connect to several database in SQL Server 2008 R2 Pin
uspatel20-Oct-12 19:03
professionaluspatel20-Oct-12 19:03 
AnswerRe: how I can make the intranet developed in c # to connect to several database in SQL Server 2008 R2 Pin
Mycroft Holmes21-Oct-12 16:16
professionalMycroft Holmes21-Oct-12 16:16 
Questionerror "object reference not set to an instance of an object" c# Pin
madimboo20-Oct-12 12:30
madimboo20-Oct-12 12:30 
I am Brazilian and my English is not very good, sorry if I do not understand what I mean

This is my stored procedure:
MySQL
DELIMITER $$
DROP PROCEDURE IF EXISTS `SP_NewPassLogin` $$
CREATE PROCEDURE SP_NewPassLogin (IN val_login VARCHAR(15), IN val_password VARCHAR(30))
BEGIN
DECLARE excessao SMALLINT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET excessao = 1;
IF (val_login <> '' AND val_password <> '') THEN
START TRANSACTION;
UPDATE tbl_user SET password = val_password WHERE login = val_login;
IF excessao = 1 THEN
SELECT 'erro' AS Msg;
ROLLBACK;
ELSE
SELECT 'ok' AS Msg;
COMMIT;
END IF;
END IF;
END$$
DELIMITER;


This is my c# code in btnSave_Click:

C#
private void btnSave_Click(object sender, EventArgs e)
        {
         using (MySqlConnection conexaoMySQL = Conexaodb.getInstancia().getConexao())
            {
                try
                {
                    conexaoMySQL.Open();
                    MySqlCommand cmd = new MySqlCommand("SP_NewPassLogin", conexaoMySQL);
                    cmd.CommandType = CommandType.StoredProcedure;
                    //this is the class that gets the login name so that the User can enter a password if the bank is NULL
                    cmd.Parameters.AddWithValue("val_login", frmLogin.NomeLogin.NomeUsuario.ToLower());
                    cmd.Parameters.AddWithValue("val_password", txtPassword.Text);
                    string retorno = cmd.ExecuteScalar().ToString();
                    if (retorno == "ok")
                    {
                        MessageBox.Show("Dados atualizados com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        this.Close();
                    }
                    else if (retorno == "erro")
                    {
                        MessageBox.Show("Informações Inválidas!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Houve problemas. Erro: \n\n" + ex.Message);
                }
                finally
                {
                    if (conexaoMySQL.State == ConnectionState.Open) conexaoMySQL.Close();
                }
            }
}


According to my research I have to do reference the object, how can I do this?

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.