Click here to Skip to main content
15,900,108 members
Home / Discussions / C#
   

C#

 
GeneralParameterized Queries Pin
BBatts4-Dec-13 3:17
BBatts4-Dec-13 3:17 
GeneralRe: Parameterized Queries Pin
Simon_Whale4-Dec-13 3:23
Simon_Whale4-Dec-13 3:23 
GeneralRe: Parameterized Queries Pin
PIEBALDconsult4-Dec-13 4:19
mvePIEBALDconsult4-Dec-13 4:19 
GeneralRe: Parameterized Queries Pin
Eddy Vluggen4-Dec-13 7:07
professionalEddy Vluggen4-Dec-13 7:07 
GeneralRe: Parameterized Queries Pin
BBatts5-Dec-13 2:22
BBatts5-Dec-13 2:22 
Questionanyone tried Xamarin? Pin
Jassim Rahma4-Dec-13 3:04
Jassim Rahma4-Dec-13 3:04 
AnswerRe: anyone tried Xamarin? Pin
thatraja4-Dec-13 3:47
professionalthatraja4-Dec-13 3:47 
QuestionUpdate stored procedure doesn't update, it keeps on saying info modification fails, please help Pin
Member 103378794-Dec-13 1:00
Member 103378794-Dec-13 1:00 
private void Update_Click(object sender, EventArgs e)
{


try
{


if (connect.State == ConnectionState.Open)
{
connect.Close();
}
connect.Open();


SqlCommand cmd = connect.CreateCommand();
cmd = new SqlCommand("sp_UpdateDepartStaff", connect);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue("@StaffID", SqlDbType.Int).Value = logInIDTextBox.Text.ToString();
cmd.Parameters.AddWithValue("@LogInID", SqlDbType.Int).Value = staffIDTextBox.Text.ToString();
cmd.Parameters.AddWithValue("@StaffRoleID", SqlDbType.Int).Value = staffRoleIDTextBox.Text.ToString();
cmd.Parameters.AddWithValue("@FirstName", SqlDbType.NVarChar).Value = firstNameTextBox.Text;
cmd.Parameters.AddWithValue("@LastName", SqlDbType.NVarChar).Value = lastNameTextBox.Text;
cmd.Parameters.AddWithValue("@UserName", SqlDbType.NVarChar).Value = userNameTextBox.Text;
cmd.Parameters.AddWithValue("@Password", SqlDbType.NVarChar).Value = passwordTextBox.Text;
cmd.Parameters.AddWithValue("@Email", SqlDbType.NVarChar).Value = emailTextBox.Text;
cmd.Parameters.AddWithValue("@Phone", SqlDbType.NVarChar).Value = phoneTextBox.Text;

cmd.Parameters.AddWithValue("@StaffRole", SqlDbType.NVarChar).Value = staffRoleTextBox.Text;
cmd.Parameters.AddWithValue("@Department", SqlDbType.NVarChar).Value = departmentTextBox.Text;

// cmd.Parameters.Add(new SqlParameter("@ProfilePic", SqlDbType.Image));

MemoryStream MemStream = new MemoryStream();
byte[] DataPic_Update = null;

this.profilePicPictureBox.Image.Save(MemStream, ImageFormat.Png);
DataPic_Update = MemStream.GetBuffer();
MemStream.Read(DataPic_Update, 0, DataPic_Update.Length);

// image content
SqlParameter photo = new SqlParameter("@profilePic", SqlDbType.Image);
photo.Value = DataPic_Update;
cmd.Parameters.Add(photo);

int temp = 0;
temp = cmd.ExecuteNonQuery();

if (temp > 0)
{
connect.Close();
MessageBox.Show("Your info updated successfully... ");//, MessageBox.Show.Information, "Record Updated");

}
else
{
connect.Close();
MessageBox.Show("Your info modification failed ");//, MsgBoxStyle.Critical, "Modificatio Failed");
return;
}

//cmd.ExecuteNonQuery();

//MessageBox.Show("Updated Successfully!");

//connect.Close();


}


catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
AnswerRe: Update stored procedure doesn't update, it keeps on saying info modification fails, please help Pin
Chris Quinn4-Dec-13 1:05
Chris Quinn4-Dec-13 1:05 
AnswerRe: Update stored procedure doesn't update, it keeps on saying info modification fails, please help Pin
Simon_Whale4-Dec-13 1:12
Simon_Whale4-Dec-13 1:12 
AnswerRe: Update stored procedure doesn't update, it keeps on saying info modification fails, please help Pin
toyfercho4-Dec-13 6:13
toyfercho4-Dec-13 6:13 
QuestionRegarding app.config in windows application Pin
tarun kumar sahu hs4-Dec-13 0:52
tarun kumar sahu hs4-Dec-13 0:52 
AnswerRe: Regarding app.config in windows application Pin
Colin Angus Mackay4-Dec-13 1:19
Colin Angus Mackay4-Dec-13 1:19 
AnswerRe: Regarding app.config in windows application Pin
Simon_Whale4-Dec-13 1:19
Simon_Whale4-Dec-13 1:19 
AnswerRe: Regarding app.config in windows application Pin
joginder-banger11-Dec-13 7:40
professionaljoginder-banger11-Dec-13 7:40 
QuestionHow to convert ... Pin
Member 94738093-Dec-13 18:53
Member 94738093-Dec-13 18:53 
AnswerRe: How to convert ... Pin
Pete O'Hanlon3-Dec-13 19:26
mvePete O'Hanlon3-Dec-13 19:26 
AnswerRe: How to convert ... Pin
-*-Star-*-6-Dec-13 0:51
-*-Star-*-6-Dec-13 0:51 
GeneralRe: How to convert ... Pin
Pete O'Hanlon6-Dec-13 0:54
mvePete O'Hanlon6-Dec-13 0:54 
QuestionFind examples MDI Parent Child Form Load as shown in Figure Pin
Member 24584673-Dec-13 17:47
Member 24584673-Dec-13 17:47 
AnswerRe: Find examples MDI Parent Child Form Load as shown in Figure Pin
Dave Kreskowiak3-Dec-13 18:16
mveDave Kreskowiak3-Dec-13 18:16 
GeneralRe: Find examples MDI Parent Child Form Load as shown in Figure Pin
Member 24584674-Dec-13 21:57
Member 24584674-Dec-13 21:57 
GeneralRe: Find examples MDI Parent Child Form Load as shown in Figure Pin
Dave Kreskowiak5-Dec-13 2:43
mveDave Kreskowiak5-Dec-13 2:43 
AnswerRe: Find examples MDI Parent Child Form Load as shown in Figure Pin
WuRunZhe6-Dec-13 14:38
WuRunZhe6-Dec-13 14:38 
GeneralRe: Find examples MDI Parent Child Form Load as shown in Figure Pin
Member 24584678-Dec-13 17:58
Member 24584678-Dec-13 17:58 

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.