Click here to Skip to main content
15,891,427 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataGrid Issue Please HELP Pin
Christian Graus19-Sep-05 18:15
protectorChristian Graus19-Sep-05 18:15 
GeneralRe: DataGrid Issue Please HELP Pin
Taurian11019-Sep-05 18:39
Taurian11019-Sep-05 18:39 
QuestionProblem with this function.. Pin
Yannielsen19-Sep-05 10:19
Yannielsen19-Sep-05 10:19 
AnswerRe: Problem with this function.. Pin
Christian Graus19-Sep-05 11:37
protectorChristian Graus19-Sep-05 11:37 
AnswerRe: Problem with this function.. Pin
miah alom19-Sep-05 11:38
miah alom19-Sep-05 11:38 
GeneralRe: Problem with this function.. Pin
Yannielsen19-Sep-05 12:23
Yannielsen19-Sep-05 12:23 
QuestionFiltering Publisher ID with LCE (COM+) Pin
Fred dBu19-Sep-05 10:11
Fred dBu19-Sep-05 10:11 
QuestionC# and SQL database Pin
Drew McGhie19-Sep-05 9:46
Drew McGhie19-Sep-05 9:46 
Ok, so I’m a month into my first programming job, and I’ve run into a little problem, hopefully I’ll be able to get help here (its worked before for a school project).

I’m manipulating a SQL database in C# (using the latest 2005 releases of .NET and SQL Server, if that helps), and I’m having some problems updating the Tables correctly.

I’m manipulating a Form, which can have multiple versions. Each form has an ID (“Key”) and each version has an ID as well (“VersionKey”). One Key can relate to multiple VersionKeys, but each VersionKey is unique and only corresponds back to one Key.

The two important tables are organized as follows:

BaseTable:
*Key
Latest Version (the version to load on startup)
(Other nonimportant stuff)

VersionTable:
*VersionKey
Key
(Other nonimportant stuff)

My problem is in creating a new “version”. Here’s simplified code:

1: VersionRow dr = (VersionRow)myDataSet.VersionTable.NewRow();
(Assign the other entries in the row)
2: myDataSet.VersionTable.Rows.Add(dr);
3: myDataSet.Basetable.FindbyKey(currentKey).LatestVersion=dr.VersionKey;
4: (Save function)

#1 generates a new (unique)VersionKey, #2 adds the row to the set, and #3(should) assign the new row's versionkey to it's Key's latestVersion key so the newest version that we're making now will load at startup on the next run.

The problem (and I know the cause) is that the value given to dr.VersionKey is not necessarily the value it will be saved as in the database on the server. At the moment, if I start running off the current partially filled database, displaying dr.VersionKey in a messagebox gives me 15, but that row is saved to a number in the 70’s(it goes up one each time I save to the database). Ordinarily, this wouldn’t be a problem, but I want to set the Latest Version parameter, and I cannot set it with the wrong value that my database generates.

Any ideas on how to retrieve what primary key value the datarow was given?



-- modified at 15:48 Monday 19th September, 2005 (Aparrantly a college degree doesn't make me typo any less)
AnswerRe: C# and SQL database Pin
Jim_Stanley19-Sep-05 13:54
Jim_Stanley19-Sep-05 13:54 
QuestionOverride Paint Method for DataGrid Pin
zaboboa19-Sep-05 9:41
zaboboa19-Sep-05 9:41 
AnswerRe: Override Paint Method for DataGrid Pin
Dave Kreskowiak19-Sep-05 12:53
mveDave Kreskowiak19-Sep-05 12:53 
GeneralRe: Override Paint Method for DataGrid Pin
zaboboa20-Sep-05 1:48
zaboboa20-Sep-05 1:48 
QuestionProblem with ByValue Parameters Pin
Seraphin19-Sep-05 8:24
Seraphin19-Sep-05 8:24 
AnswerRe: Problem with ByValue Parameters Pin
KaptinKrunch19-Sep-05 8:38
KaptinKrunch19-Sep-05 8:38 
GeneralRe: Problem with ByValue Parameters Pin
Seraphin19-Sep-05 8:48
Seraphin19-Sep-05 8:48 
GeneralRe: Problem with ByValue Parameters Pin
KaptinKrunch19-Sep-05 8:53
KaptinKrunch19-Sep-05 8:53 
GeneralRe: Problem with ByValue Parameters Pin
Seraphin19-Sep-05 9:10
Seraphin19-Sep-05 9:10 
GeneralBad solution - copy objects Pin
Seraphin19-Sep-05 9:19
Seraphin19-Sep-05 9:19 
GeneralRe: Bad solution - copy objects Pin
tommazzo19-Sep-05 10:36
tommazzo19-Sep-05 10:36 
QuestionC# reference parameter Pin
Csupor Jenő19-Sep-05 7:32
Csupor Jenő19-Sep-05 7:32 
AnswerRe: C# reference parameter Pin
Dave Kreskowiak19-Sep-05 8:34
mveDave Kreskowiak19-Sep-05 8:34 
GeneralRe: C# reference parameter Pin
Csupor Jenő19-Sep-05 8:51
Csupor Jenő19-Sep-05 8:51 
GeneralRe: C# reference parameter Pin
Dave Kreskowiak19-Sep-05 9:28
mveDave Kreskowiak19-Sep-05 9:28 
QuestionANDing, XOR 2 images Pin
DeepToot19-Sep-05 7:32
DeepToot19-Sep-05 7:32 
AnswerRe: ANDing, XOR 2 images Pin
Christian Graus19-Sep-05 11:40
protectorChristian Graus19-Sep-05 11:40 

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.