Click here to Skip to main content
15,868,141 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: Barcode generation in Winforms Pin
drewclark39816-Apr-12 17:15
drewclark39816-Apr-12 17:15 
AnswerRe: Barcode generation in Winforms Pin
elvaernle94316-Apr-12 21:11
elvaernle94316-Apr-12 21:11 
AnswerRe: Barcode generation in Winforms Pin
elvaernle94316-Apr-12 22:07
elvaernle94316-Apr-12 22:07 
GeneralRe: Barcode generation in Winforms Pin
Eddy Vluggen28-Aug-15 5:39
professionalEddy Vluggen28-Aug-15 5:39 
QuestionLeave event is not working. Pin
nitish_0715-Apr-12 8:16
nitish_0715-Apr-12 8:16 
AnswerRe: Leave event is not working. Pin
Luc Pattyn15-Apr-12 8:39
sitebuilderLuc Pattyn15-Apr-12 8:39 
GeneralRe: Leave event is not working. Pin
nitish_0715-Apr-12 9:45
nitish_0715-Apr-12 9:45 
QuestionNot able to call the procedure. Pin
nitish_0715-Apr-12 4:44
nitish_0715-Apr-12 4:44 
OdbcCommand cmd = new OdbcCommand();
            try
            {
                // cn.Open();
                cmd.Connection = cn;
                cmd.CommandText = "use userdb";
                cmd.ExecuteNonQuery();
                cmd.CommandText = "DROP PROCEDURE IF EXISTS add_emp";
                cmd.ExecuteNonQuery();
                
                cmd.CommandText = "CREATE TABLE emp (empno INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(20), last_name VARCHAR(20), birthdate DATE)";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "CREATE PROCEDURE add_emp(" +
                                  "IN fname VARCHAR(20), IN lname VARCHAR(20), IN bday DATETIME)" +
                                  "BEGIN INSERT INTO emp(first_name, last_name, birthdate) " +
                                  "VALUES(fname, lname, DATE(bday));  END";

                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            cn.Close();
            Console.WriteLine("Connection closed.");
            try
            {
                Console.WriteLine("Connecting to MySQL...");
                cn.Open();
                cmd.Connection = cn;

                cmd.CommandText = "add_emp;";
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("?lname", "Jones");
                cmd.Parameters["?lname"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("?fname", "Tom");
                cmd.Parameters["?fname"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("?bday", "1940-06-07");
                cmd.Parameters["?bday"].Direction = ParameterDirection.Input;

                //cmd.Parameters.AddWithValue("@empno", MySqlDbType.Int32);
                //cmd.Parameters["@empno"].Direction = ParameterDirection.Output;

                cmd.ExecuteNonQuery();

                            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
           
            cn.Close();
            Console.WriteLine("Done.");
        }

By this code procedure is created successfully bt when it comes to calling that procedure it throws an error
System.Data.Odbc.OdbcException: ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.77-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'add_emp' at line 1

AnswerRe: Not able to call the procedure. Pin
phil.o15-Apr-12 5:46
professionalphil.o15-Apr-12 5:46 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 6:31
nitish_0715-Apr-12 6:31 
AnswerRe: Not able to call the procedure. Pin
Luc Pattyn15-Apr-12 5:49
sitebuilderLuc Pattyn15-Apr-12 5:49 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 6:23
nitish_0715-Apr-12 6:23 
GeneralRe: Not able to call the procedure. Pin
Luc Pattyn15-Apr-12 6:26
sitebuilderLuc Pattyn15-Apr-12 6:26 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 6:30
nitish_0715-Apr-12 6:30 
AnswerRe: Not able to call the procedure. Pin
Luc Pattyn15-Apr-12 6:38
sitebuilderLuc Pattyn15-Apr-12 6:38 
AnswerRe: Not able to call the procedure. Pin
Wes Aday15-Apr-12 7:01
professionalWes Aday15-Apr-12 7:01 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 7:17
nitish_0715-Apr-12 7:17 
AnswerRe: Not able to call the procedure. Pin
Dave Kreskowiak15-Apr-12 7:50
mveDave Kreskowiak15-Apr-12 7:50 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 7:53
nitish_0715-Apr-12 7:53 
AnswerRe: Not able to call the procedure. Pin
Bernhard Hiller15-Apr-12 21:42
Bernhard Hiller15-Apr-12 21:42 
GeneralRe: Not able to call the procedure. Pin
nitish_0716-Apr-12 8:28
nitish_0716-Apr-12 8:28 
AnswerRe: Not able to call the procedure. Pin
Luc Pattyn16-Apr-12 8:55
sitebuilderLuc Pattyn16-Apr-12 8:55 
GeneralRe: Not able to call the procedure. Pin
nitish_0716-Apr-12 9:20
nitish_0716-Apr-12 9:20 
AnswerRe: Not able to call the procedure. Pin
karthiDebug25-Apr-12 19:11
karthiDebug25-Apr-12 19:11 
QuestionHow to create mysql stored function from c#.net Pin
nitish_0714-Apr-12 23:51
nitish_0714-Apr-12 23:51 

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.