Click here to Skip to main content
16,007,885 members
Home / Discussions / C#
   

C#

 
AnswerRe: I am trying to dispaly database values based on the combobox selection and i get this error "Data is null. this method cannot be called on null values" Pin
WuRunZhe6-Dec-13 14:33
WuRunZhe6-Dec-13 14:33 
QuestionAsp.Net with C# Pin
ChandrakanthGaddam5-Dec-13 5:46
ChandrakanthGaddam5-Dec-13 5:46 
AnswerRe: Asp.Net with C# Pin
Simon_Whale5-Dec-13 6:06
Simon_Whale5-Dec-13 6:06 
QuestionRe: Asp.Net with C# Pin
Eddy Vluggen5-Dec-13 8:00
professionalEddy Vluggen5-Dec-13 8:00 
AnswerRe: Asp.Net with C# Pin
Abhinav S5-Dec-13 17:28
Abhinav S5-Dec-13 17:28 
GeneralRe: Asp.Net with C# Pin
ChandrakanthGaddam6-Dec-13 3:38
ChandrakanthGaddam6-Dec-13 3:38 
AnswerRe: Asp.Net with C# Pin
thatraja6-Dec-13 2:20
professionalthatraja6-Dec-13 2:20 
QuestionI am trying to update information using combobox to the database and the error it gives is "Object reference not set to an instance of an object" Pin
Member 103378795-Dec-13 2:46
Member 103378795-Dec-13 2:46 
Below is my stored procedure

ALTER PROCEDURE [dbo].[sp_Workflow]
@TicketID int output,
@StaffID int output,
@Department nvarchar (50),
@FirstName nvarchar (50),
@TicketStatusID int output,
@TicketStatus nvarchar (50),
@TicketPriorityID int output,
@TicketPriority nvarchar (50)

AS
BEGIN

UPDATE dbo.Staff
SET
FirstName = @FirstName,

Department = @Department
WHERE StaffID= @StaffID

UPDATE dbo.TicketStatus
SET
TicketStatus = @TicketStatus
WHERE TicketStatusID =@TicketStatusID


UPDATE dbo.TicketPriority
SET
TicketPriority = @TicketPriority
WHERE TicketPriorityID =@TicketPriorityID

END

T Smile | :) his is my code

private void Updatebutton_Click(object sender, EventArgs e)
{

con.Open();
SqlCommand cmd = con.CreateCommand();
cmd = new SqlCommand("sp_Workflow", con);
cmd.CommandType = CommandType.StoredProcedure;


cmd.Parameters.AddWithValue("@TicketID", System.Data.SqlDbType.Int).Value = TicketIDcomboBox.ToString();
cmd.Parameters.Add("@Department", System.Data.SqlDbType.NVarChar, 50).Value = MoveToDepartmentcomboBox.SelectedValue.ToString();
cmd.Parameters.Add("@FirstName", System.Data.SqlDbType.NVarChar, 50).Value = StaffcomboBox.SelectedValue.ToString();
cmd.Parameters.Add("@TicketStatus", System.Data.SqlDbType.NVarChar, 50).Value = ChangeTicketStatuscomboBox.SelectedValue.ToString();
cmd.Parameters.Add("@TicketPriorty", System.Data.SqlDbType.NVarChar, 50).Value = ChangeTicketPrioritycomboBox.SelectedValue.ToString();

MessageBox.Show("Are you sure you want to update?");

cmd.ExecuteNonQuery();
MessageBox.Show("Ticket Updated");
con.Close();
}

}
AnswerRe: I am trying to update information using combobox to the database and the error it gives is "Object reference not set to an instance of an object" Pin
Pete O'Hanlon5-Dec-13 2:50
mvePete O'Hanlon5-Dec-13 2:50 
AnswerRe: I am trying to update information using combobox to the database and the error it gives is "Object reference not set to an instance of an object" Pin
BillWoodruff5-Dec-13 4:05
professionalBillWoodruff5-Dec-13 4:05 
AnswerRe: I am trying to update information using combobox to the database and the error it gives is "Object reference not set to an instance of an object" Pin
Abhinav S5-Dec-13 17:29
Abhinav S5-Dec-13 17:29 
Questioncheck connection Pin
Karim Hesham5-Dec-13 1:58
Karim Hesham5-Dec-13 1:58 
AnswerRe: check connection Pin
BillWoodruff5-Dec-13 2:19
professionalBillWoodruff5-Dec-13 2:19 
GeneralRe: check connection Pin
Pete O'Hanlon5-Dec-13 2:47
mvePete O'Hanlon5-Dec-13 2:47 
GeneralRe: check connection Pin
OriginalGriff5-Dec-13 3:43
mveOriginalGriff5-Dec-13 3:43 
AnswerRe: check connection Pin
Wendelius5-Dec-13 2:21
mentorWendelius5-Dec-13 2:21 
QuestionFile & folder overlay icon using C# Pin
Tapas Saha4-Dec-13 22:03
Tapas Saha4-Dec-13 22:03 
AnswerRe: File & folder overlay icon using C# Pin
Pete O'Hanlon4-Dec-13 22:17
mvePete O'Hanlon4-Dec-13 22:17 
GeneralRe: File & folder overlay icon using C# Pin
Richard MacCutchan4-Dec-13 22:19
mveRichard MacCutchan4-Dec-13 22:19 
AnswerRe: File & folder overlay icon using C# Pin
Richard MacCutchan4-Dec-13 22:18
mveRichard MacCutchan4-Dec-13 22:18 
GeneralRe: File & folder overlay icon using C# Pin
Tapas Saha4-Dec-13 22:24
Tapas Saha4-Dec-13 22:24 
GeneralRe: File & folder overlay icon using C# Pin
Richard MacCutchan4-Dec-13 23:10
mveRichard MacCutchan4-Dec-13 23:10 
GeneralRe: File & folder overlay icon using C# Pin
Tapas Saha4-Dec-13 23:30
Tapas Saha4-Dec-13 23:30 
GeneralRe: File & folder overlay icon using C# Pin
Richard MacCutchan4-Dec-13 23:34
mveRichard MacCutchan4-Dec-13 23:34 
GeneralRe: File & folder overlay icon using C# Pin
Dave Kreskowiak5-Dec-13 2:20
mveDave Kreskowiak5-Dec-13 2:20 

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.