Click here to Skip to main content
15,118,063 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: Barcode generation in Winforms Pin
elvaernle94316-Apr-12 22:11
Memberelvaernle94316-Apr-12 22:11 
AnswerRe: Barcode generation in Winforms Pin
elvaernle94316-Apr-12 23:07
Memberelvaernle94316-Apr-12 23:07 
GeneralRe: Barcode generation in Winforms Pin
Eddy Vluggen28-Aug-15 6:39
professionalEddy Vluggen28-Aug-15 6:39 
QuestionLeave event is not working. Pin
nitish_0715-Apr-12 9:16
Membernitish_0715-Apr-12 9:16 
AnswerRe: Leave event is not working. Pin
Luc Pattyn15-Apr-12 9:39
sitebuilderLuc Pattyn15-Apr-12 9:39 
GeneralRe: Leave event is not working. Pin
nitish_0715-Apr-12 10:45
Membernitish_0715-Apr-12 10:45 
QuestionNot able to call the procedure. Pin
nitish_0715-Apr-12 5:44
Membernitish_0715-Apr-12 5: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 6:46
mvephil.o15-Apr-12 6:46 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 7:31
Membernitish_0715-Apr-12 7:31 
AnswerRe: Not able to call the procedure. Pin
Luc Pattyn15-Apr-12 6:49
sitebuilderLuc Pattyn15-Apr-12 6:49 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 7:23
Membernitish_0715-Apr-12 7:23 
GeneralRe: Not able to call the procedure. Pin
Luc Pattyn15-Apr-12 7:26
sitebuilderLuc Pattyn15-Apr-12 7:26 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 7:30
Membernitish_0715-Apr-12 7:30 
AnswerRe: Not able to call the procedure. Pin
Luc Pattyn15-Apr-12 7:38
sitebuilderLuc Pattyn15-Apr-12 7:38 
AnswerRe: Not able to call the procedure. Pin
Wes Aday15-Apr-12 8:01
professionalWes Aday15-Apr-12 8:01 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 8:17
Membernitish_0715-Apr-12 8:17 
AnswerRe: Not able to call the procedure. Pin
Dave Kreskowiak15-Apr-12 8:50
mveDave Kreskowiak15-Apr-12 8:50 
GeneralRe: Not able to call the procedure. Pin
nitish_0715-Apr-12 8:53
Membernitish_0715-Apr-12 8:53 
AnswerRe: Not able to call the procedure. Pin
Bernhard Hiller15-Apr-12 22:42
MemberBernhard Hiller15-Apr-12 22:42 
GeneralRe: Not able to call the procedure. Pin
nitish_0716-Apr-12 9:28
Membernitish_0716-Apr-12 9:28 
AnswerRe: Not able to call the procedure. Pin
Luc Pattyn16-Apr-12 9:55
sitebuilderLuc Pattyn16-Apr-12 9:55 
GeneralRe: Not able to call the procedure. Pin
nitish_0716-Apr-12 10:20
Membernitish_0716-Apr-12 10:20 
AnswerRe: Not able to call the procedure. Pin
karthiDebug25-Apr-12 20:11
MemberkarthiDebug25-Apr-12 20:11 
QuestionHow to create mysql stored function from c#.net Pin
nitish_0715-Apr-12 0:51
Membernitish_0715-Apr-12 0:51 
AnswerRe: How to create mysql stored function from c#.net Pin
Eddy Vluggen15-Apr-12 1:30
professionalEddy Vluggen15-Apr-12 1:30 

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.