Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
GeneralRe: Insert statment for multiple tables Pin
xfitr229-Aug-07 17:02
xfitr229-Aug-07 17:02 
GeneralRe: Insert statment for multiple tables Pin
falles0129-Aug-07 17:10
falles0129-Aug-07 17:10 
GeneralRe: Insert statment for multiple tables Pin
xfitr229-Aug-07 17:14
xfitr229-Aug-07 17:14 
GeneralRe: Insert statment for multiple tables Pin
Michael Sync29-Aug-07 17:24
Michael Sync29-Aug-07 17:24 
GeneralRe: Insert statment for multiple tables Pin
Vikram A Punathambekar29-Aug-07 17:37
Vikram A Punathambekar29-Aug-07 17:37 
GeneralRe: Insert statment for multiple tables Pin
falles0129-Aug-07 18:06
falles0129-Aug-07 18:06 
GeneralRe: Insert statment for multiple tables Pin
falles0129-Aug-07 18:02
falles0129-Aug-07 18:02 
GeneralRe: Insert statment for multiple tables Pin
falles0129-Aug-07 18:42
falles0129-Aug-07 18:42 
Okay I apologise for pasting so much info but I've done as you said. My code looks like this, but I get the null error which I've shown you at the bottom.
If you can help, I'll vote you high for every message you've sent to me today. Rose | [Rose] I notice that I got this same error when I was using my normal insert statement. what am I doing wrong you think?

SqlCommand sqlC = new SqlCommand("sp_InsertEmployee", myConnection);

sqlC.CommandType = CommandType.StoredProcedure;

sqlC.Parameters.Add(new SqlParameter("@Firstname", SqlDbType.VarChar, 0, "Firstname"));

sqlC.Parameters.Add(new SqlParameter("@Lastname", SqlDbType.VarChar, 50, "Lastname"));
sqlC.Parameters.Add(new SqlParameter("@Role", SqlDbType.VarChar, 0, "Role"));

sqlC.Parameters.Add(new SqlParameter("@Manager", SqlDbType.VarChar, 50, "Manager"));
sqlC.Parameters.Add(new SqlParameter("@Division", SqlDbType.VarChar, 0, "Division"));

//sqlC.Parameters[0].Value = 4;
sqlC.Parameters[0].Value = FirsttextBox.Text.ToString();
sqlC.Parameters[1].Value = LasttextBox.Text.ToString();
sqlC.Parameters[2].Value = RolecomboBox1.Text.ToString();
sqlC.Parameters[3].Value = ManagercomboBox1.Text.ToString();
sqlC.Parameters[4].Value = DivisioncomboBox1.Text.ToString();



int i = sqlC.ExecuteNonQuery();


Error::::Cannot insert the value NULL into column 'RoleID', table 'Dev_RST.dbo.employees'; column does not allow nulls. INSERT fails.
The statement has been terminated.


GeneralRe: Insert statment for multiple tables Pin
falles0129-Aug-07 19:06
falles0129-Aug-07 19:06 
GeneralRe: Insert statment for multiple tables Pin
xfitr230-Aug-07 3:09
xfitr230-Aug-07 3:09 
GeneralRe: Insert statment for multiple tables Pin
falles0130-Aug-07 19:18
falles0130-Aug-07 19:18 
GeneralRe: Insert statment for multiple tables Pin
falles0129-Aug-07 16:55
falles0129-Aug-07 16:55 
QuestionXML Attributes Pin
ytubis29-Aug-07 12:14
ytubis29-Aug-07 12:14 
AnswerRe: XML Attributes Pin
PIEBALDconsult29-Aug-07 13:17
mvePIEBALDconsult29-Aug-07 13:17 
AnswerRe: XML Attributes Pin
Spacix One29-Aug-07 15:07
Spacix One29-Aug-07 15:07 
GeneralRe: XML Attributes Pin
ytubis29-Aug-07 19:54
ytubis29-Aug-07 19:54 
AnswerRe: XML Attributes Pin
Spacix One30-Aug-07 3:16
Spacix One30-Aug-07 3:16 
QuestionCreate Dynamic Buttons with EvenHandler C# Pin
I Believe In GOD29-Aug-07 10:39
I Believe In GOD29-Aug-07 10:39 
AnswerRe: Create Dynamic Buttons with EvenHandler C# [modified] Pin
Spacix One29-Aug-07 11:49
Spacix One29-Aug-07 11:49 
GeneralRe: Create Dynamic Buttons with EvenHandler C# Pin
I Believe In GOD30-Aug-07 0:13
I Believe In GOD30-Aug-07 0:13 
AnswerRe: Create Dynamic Buttons with EvenHandler C# Pin
BoneSoft29-Aug-07 12:20
BoneSoft29-Aug-07 12:20 
AnswerRe: Create Dynamic Buttons with EvenHandler C# Pin
PIEBALDconsult29-Aug-07 13:19
mvePIEBALDconsult29-Aug-07 13:19 
AnswerRe: Create Dynamic Buttons with EvenHandler C# Pin
Not Active29-Aug-07 17:44
mentorNot Active29-Aug-07 17:44 
GeneralRe: Create Dynamic Buttons with EvenHandler C# Pin
I Believe In GOD30-Aug-07 0:21
I Believe In GOD30-Aug-07 0:21 
GeneralRe: Create Dynamic Buttons with EvenHandler C# Pin
Not Active30-Aug-07 2:10
mentorNot Active30-Aug-07 2:10 

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.