Click here to Skip to main content
15,885,998 members
Home / Discussions / C#
   

C#

 
AnswerRe: sevenzipsharp password Pin
Dave Kreskowiak11-Feb-18 11:01
mveDave Kreskowiak11-Feb-18 11:01 
GeneralRe: sevenzipsharp password Pin
BillWoodruff11-Feb-18 23:10
professionalBillWoodruff11-Feb-18 23:10 
GeneralRe: sevenzipsharp password Pin
Dave Kreskowiak12-Feb-18 2:30
mveDave Kreskowiak12-Feb-18 2:30 
AnswerRe: sevenzipsharp password Pin
BillWoodruff11-Feb-18 23:11
professionalBillWoodruff11-Feb-18 23:11 
SuggestionMessage Removed Pin
10-Feb-18 9:12
Markhoernchen10-Feb-18 9:12 
GeneralMessage Removed Pin
10-Feb-18 9:59
mveRichard MacCutchan10-Feb-18 9:59 
AnswerMessage Removed Pin
10-Feb-18 11:28
Markhoernchen10-Feb-18 11:28 
QuestionError with Primary key in Sql database Pin
Member 1367168610-Feb-18 7:32
Member 1367168610-Feb-18 7:32 
I'm getting an issue when I try to input data into a web page. However the issue is with my primary/foreign key in the database. Any help would be much appreciated.

Error message:
Error:System.Data.SqlClient.SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "UserIDfk". The conflict occurred in database "\\MAC\HOME\DOCUMENTS\COLLEGE\4TH YEAR\FYP\ITERATION 1\FYP-NEW\FYP-PARKWAY\FYP-PARKWAY\APP_DATA\USERDATA.MDF", table "dbo.Registration", column 'UserID'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at FYP_ParkWay.ListSpace.Button1_Click(Object sender, EventArgs e) in \\Mac\Home\Documents\College\4th Year\FYP\Iteration 1\FYP-NEW\FYP-ParkWay\FYP-ParkWay\ListSpace.aspx.cs:line 30 ClientConnectionId:dbdeb098-62a6-45bf-960b-374be8a4e13f Error Number:547,State: 0,Class:16

My primary key is:
CREATE TABLE [dbo].[Registration] (
[UserID] INT IDENTITY (1, 1) NOT NULL,
[Name] NCHAR (20) NULL,
[Surname] NCHAR (20) NULL,
[Email] NCHAR (30) NULL,
[Address] NCHAR (50) NULL,
[Phone] NVARCHAR (50) NULL,
[Password] NCHAR (30) NULL,
CONSTRAINT [pk_UserID] PRIMARY KEY CLUSTERED ([UserID] ASC)
)

The insert statement in which its referring is:
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
conn.Open();

String insertQuery = "insert into ListSpace (Area,Date,StartTime,EndTime,Picture) values(@area, @date, @startTime, @endTime, @picture)";
SqlCommand com = new SqlCommand(insertQuery, conn);
com.Parameters.AddWithValue("@area", ddlArea.Text);
com.Parameters.AddWithValue("@date", cdrDate.SelectedDate);
com.Parameters.AddWithValue("@startTime", ddlStart.Text);
com.Parameters.AddWithValue("@endTime", ddlEnd.Text);
com.Parameters.AddWithValue("@picture", updPicture.FileBytes);

com.ExecuteNonQuery();
AnswerRe: Error with Primary key in Sql database Pin
Wendelius10-Feb-18 8:27
mentorWendelius10-Feb-18 8:27 
QuestionSplit a String of numbers in textfield Pin
auting829-Feb-18 11:06
auting829-Feb-18 11:06 
AnswerRe: Split a String of numbers in textfield Pin
Luc Pattyn9-Feb-18 16:22
sitebuilderLuc Pattyn9-Feb-18 16:22 
GeneralRe: Split a String of numbers in textfield Pin
auting8210-Feb-18 8:03
auting8210-Feb-18 8:03 
GeneralRe: Split a String of numbers in textfield Pin
Luc Pattyn10-Feb-18 8:41
sitebuilderLuc Pattyn10-Feb-18 8:41 
AnswerRe: Split a String of numbers in textfield Pin
Richard MacCutchan9-Feb-18 21:58
mveRichard MacCutchan9-Feb-18 21:58 
Questionmodeling n-variable polynomial where n isn't known until runtime Pin
Alexander Kindel9-Feb-18 10:06
Alexander Kindel9-Feb-18 10:06 
AnswerRe: modeling n-variable polynomial where n isn't known until runtime Pin
Alexander Kindel10-Feb-18 4:03
Alexander Kindel10-Feb-18 4:03 
QuestionI do not know English very well, so my question may be incomprehensible .I wanted to create a program that should determine the frequency of spreading it. Pin
Bek Boltayev9-Feb-18 9:48
Bek Boltayev9-Feb-18 9:48 
AnswerRe: I do not know English very well, so my question may be incomprehensible .I wanted to create a program that should determine the frequency of spreading it. Pin
Pete O'Hanlon9-Feb-18 10:10
mvePete O'Hanlon9-Feb-18 10:10 
QuestionHow can I create a program that shows information on DVB-T2 USB and shows it in a noutbook ??? Pin
Bek Boltayev9-Feb-18 9:42
Bek Boltayev9-Feb-18 9:42 
AnswerRe: How can I create a program that shows information on DVB-T2 USB and shows it in a noutbook ??? Pin
Dave Kreskowiak9-Feb-18 13:27
mveDave Kreskowiak9-Feb-18 13:27 
QuestionMultiple sliders or trackbars Pin
Member 136704429-Feb-18 8:07
Member 136704429-Feb-18 8:07 
QuestionRe: Multiple sliders or trackbars Pin
Maciej Los9-Feb-18 9:03
mveMaciej Los9-Feb-18 9:03 
AnswerRe: Multiple sliders or trackbars Pin
ZurdoDev9-Feb-18 9:10
professionalZurdoDev9-Feb-18 9:10 
AnswerRe: Multiple sliders or trackbars Pin
BillWoodruff10-Feb-18 23:23
professionalBillWoodruff10-Feb-18 23:23 
GeneralRe: Multiple sliders or trackbars Pin
Member 1367044211-Feb-18 12:59
Member 1367044211-Feb-18 12: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.