Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
QuestionOpening third-party software in windows Pin
Skippums10-Sep-07 7:50
Skippums10-Sep-07 7:50 
Questionbinding question Pin
kboyette10-Sep-07 7:41
kboyette10-Sep-07 7:41 
QuestionRe: binding question Pin
kboyette11-Sep-07 14:56
kboyette11-Sep-07 14:56 
AnswerRe: binding question Pin
kboyette12-Sep-07 10:29
kboyette12-Sep-07 10:29 
GeneralRe: binding question Pin
kboyette12-Sep-07 10:38
kboyette12-Sep-07 10:38 
Questionnot-null-field issue Pin
newbieAl10-Sep-07 7:25
newbieAl10-Sep-07 7:25 
AnswerRe: not-null-field issue Pin
kboyette10-Sep-07 7:45
kboyette10-Sep-07 7:45 
GeneralRe: not-null-field issue Pin
newbieAl10-Sep-07 8:00
newbieAl10-Sep-07 8:00 
Here is the c# code that calles the stored procedure:

public void createUserProcedure(string uId, string lname, string fname, string email, string pswd, DateTime expdate, int secId, char usrStat, DateTime lgn)
{
MySqlCommand cmd = new MySqlCommand();

try
{
DB_Connection conn = new DB_Connection();
cmd.Connection = (MySqlConnection)conn.DBConnect();

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

cmd.Parameters.AddWithValue("USERID", uId);
cmd.Parameters["USERID"].Direction = ParameterDirection.Input;

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

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

cmd.Parameters.AddWithValue("USER_EMAIL", email);
cmd.Parameters["USER_EMAIL"].Direction = ParameterDirection.Input;

cmd.Parameters.AddWithValue("USER_PSWRD", pswd);
cmd.Parameters["USER_PSWRD"].Direction = ParameterDirection.Input;

cmd.Parameters.AddWithValue("USER_PASSWORD_EXPIRE_DATE", expdate);
cmd.Parameters["USER_PASSWORD_EXPIRE_DATE"].Direction = ParameterDirection.Input;

cmd.Parameters.AddWithValue("USER_SECURITY_LEVEL_ID", secId);
cmd.Parameters["USER_SECURITY_LEVEL_ID"].Direction = ParameterDirection.Input;

cmd.Parameters.AddWithValue("USER_STS", usrStat);
cmd.Parameters["USER_STS"].Direction = ParameterDirection.Input;

cmd.Parameters.AddWithValue("USER_UNSUCCESSFULL_LOGIN", lgn);
cmd.Parameters["USER_UNSUCCESSFULL_LOGIN"].Direction = ParameterDirection.Input;

cmd.ExecuteNonQuery();

}

This is how I call the procedure:
DateTime dt = new DateTime();
dt = DateTime.Parse("02/01/2007");

UserDAO test = new UserDAO();

test.createUserProcedure("test","TEST", "tst", "tst@net", null, dt, 1, 'A', dt);

Here is the stored procedure in mysql:
DELIMITER $$

DROP PROCEDURE IF EXISTS `the_vault`.`createUser` $$
CREATE DEFINER=`VAULT_DEV`@`%` PROCEDURE `createUser`(IN USERID varchar(20), IN USER_LAST_NAME VARCHAR(40), IN USER_FIRST_NAME VARCHAR(20), IN USER_EMAIL VARCHAR(50),IN USER_PSWRD VARCHAR(20), IN USER_PASSWORD_EXPIRE_DATE DATETIME, IN USER_SECURITY_LEVEL_ID INT, IN USER_STS VARCHAR(1), IN USER_UNSUCCESSFULL_LOGIN DATETIME)
BEGIN
INSERT INTO USERS VALUES(USER_ID, USER_LAST_NAME, USER_FIRST_NAME, USER_EMAIL, USER_PASSWORD, USER_PASSWORD_EXPIRE_DATE,
USER_SECURITY_LEVEL_ID, USER_STATUS, USER_UNSUCCESSFULL_LOGIN);
END $$

DELIMITER ;
GeneralRe: not-null-field issue Pin
Elina Blank10-Sep-07 8:46
sitebuilderElina Blank10-Sep-07 8:46 
GeneralRe: not-null-field issue Pin
kboyette10-Sep-07 8:54
kboyette10-Sep-07 8:54 
GeneralRe: not-null-field issue Pin
newbieAl10-Sep-07 9:18
newbieAl10-Sep-07 9:18 
GeneralRe: not-null-field issue Pin
kboyette10-Sep-07 9:53
kboyette10-Sep-07 9:53 
GeneralRe: not-null-field issue Pin
newbieAl10-Sep-07 10:24
newbieAl10-Sep-07 10:24 
GeneralRe: not-null-field issue Pin
kboyette10-Sep-07 12:01
kboyette10-Sep-07 12:01 
GeneralRe: not-null-field issue Pin
newbieAl11-Sep-07 2:24
newbieAl11-Sep-07 2:24 
GeneralRe: not-null-field issue Pin
newbieAl10-Sep-07 9:07
newbieAl10-Sep-07 9:07 
QuestionWeb Browser control speed&threading Pin
Spacix One10-Sep-07 7:01
Spacix One10-Sep-07 7:01 
Questionnext cell on DataGridView ? Pin
KreaA10-Sep-07 6:05
KreaA10-Sep-07 6:05 
Questionstatic fields for threads in c# Pin
mr.mohsen10-Sep-07 5:04
mr.mohsen10-Sep-07 5:04 
AnswerRe: static fields for threads in c# Pin
PIEBALDconsult10-Sep-07 5:20
mvePIEBALDconsult10-Sep-07 5:20 
AnswerRe: static fields for threads in c# Pin
Luc Pattyn10-Sep-07 5:38
sitebuilderLuc Pattyn10-Sep-07 5:38 
QuestionHttpWebRequest Pin
smsmfe10-Sep-07 4:54
smsmfe10-Sep-07 4:54 
AnswerRe: HttpWebRequest Pin
led mike10-Sep-07 5:23
led mike10-Sep-07 5:23 
QuestionPath stripping algorithim.....help required Pin
c#_keithy10-Sep-07 4:37
c#_keithy10-Sep-07 4:37 
AnswerRe: Path stripping algorithim.....help required Pin
Judah Gabriel Himango10-Sep-07 4:59
sponsorJudah Gabriel Himango10-Sep-07 4:59 

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.