Click here to Skip to main content
15,908,674 members
Home / Discussions / C#
   

C#

 
QuestionDependant tables Pin
Groulien15-May-11 7:17
Groulien15-May-11 7:17 
AnswerRe: Dependant tables Pin
Blue_Boy15-May-11 8:32
Blue_Boy15-May-11 8:32 
AnswerRe: Dependant tables Pin
OriginalGriff15-May-11 9:27
mveOriginalGriff15-May-11 9:27 
QuestionRe: Dependant tables Pin
Luc Pattyn15-May-11 9:45
sitebuilderLuc Pattyn15-May-11 9:45 
OriginalGriff wrote:
If you must use DB assigned ints, then you can get round the problem using a stored proceedure ...


Does one really need an SP, last week I successfully used a compound command on MySQL, basically like this:
string cmd="INSERT INTO myTable (field1, field2) VALUES(@value1, @value2); SELECT last_insert_id()";
using (MySqlCommand dbCmd=new MySqlCommand(cmd, dbCon)) {
	dbCmd.Parameters.Add("@value1", MySqlDbType.String).Value=value1;
	dbCmd.Parameters.Add("@value2", MySqlDbType.String).Value=value2;
	PK=(long)dbCmd.ExecuteScalar();  // last_insert_id() insists on type long!
	...
}

on a table with an integer auto-incrementing primary key. Are there arguments against that?

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

AnswerRe: Dependant tables Pin
OriginalGriff15-May-11 10:00
mveOriginalGriff15-May-11 10:00 
GeneralRe: Dependant tables Pin
Luc Pattyn15-May-11 10:12
sitebuilderLuc Pattyn15-May-11 10:12 
GeneralRe: Dependant tables Pin
Luc Pattyn15-May-11 10:00
sitebuilderLuc Pattyn15-May-11 10:00 
GeneralRe: Dependant tables Pin
OriginalGriff15-May-11 10:02
mveOriginalGriff15-May-11 10:02 
AnswerRe: Dependant tables Pin
Luc Pattyn15-May-11 10:08
sitebuilderLuc Pattyn15-May-11 10:08 
GeneralRe: Dependant tables Pin
OriginalGriff15-May-11 20:44
mveOriginalGriff15-May-11 20:44 
QuestionERP project - one project? Pin
Jassim Rahma15-May-11 2:40
Jassim Rahma15-May-11 2:40 
AnswerRe: ERP project - one project? Pin
Dave Kreskowiak15-May-11 3:39
mveDave Kreskowiak15-May-11 3:39 
GeneralRe: ERP project - one project? Pin
Jassim Rahma15-May-11 3:44
Jassim Rahma15-May-11 3:44 
AnswerRe: ERP project - one project? Pin
Luc Pattyn15-May-11 4:11
sitebuilderLuc Pattyn15-May-11 4:11 
AnswerRe: ERP project - one project? Pin
Dan Mos15-May-11 3:48
Dan Mos15-May-11 3:48 
AnswerRe: ERP project - one project? Pin
Keith Barrow15-May-11 3:59
professionalKeith Barrow15-May-11 3:59 
AnswerRe: ERP project - one project? Pin
Pete O'Hanlon15-May-11 9:23
mvePete O'Hanlon15-May-11 9:23 
GeneralRe: ERP project - one project? Pin
walterhevedeich15-May-11 19:21
professionalwalterhevedeich15-May-11 19:21 
AnswerRe: ERP project - one project? Pin
Prasanta_Prince15-May-11 21:18
Prasanta_Prince15-May-11 21:18 
AnswerRe: ERP project - one project? Pin
SilimSayo16-May-11 5:23
SilimSayo16-May-11 5:23 
QuestionIs There An Incantation I'm supposed To Recite To Make The Data Appear? Pin
Roger Wright14-May-11 20:32
professionalRoger Wright14-May-11 20:32 
AnswerRe: Is There An Incantation I'm supposed To Recite To Make The Data Appear? Pin
dan!sh 14-May-11 21:01
professional dan!sh 14-May-11 21:01 
GeneralRe: Is There An Incantation I'm supposed To Recite To Make The Data Appear? Pin
Roger Wright15-May-11 4:26
professionalRoger Wright15-May-11 4:26 
AnswerRe: Is There An Incantation I'm supposed To Recite To Make The Data Appear? Pin
OriginalGriff14-May-11 21:06
mveOriginalGriff14-May-11 21:06 
GeneralRe: Is There An Incantation I'm supposed To Recite To Make The Data Appear? Pin
#realJSOP15-May-11 0:32
professional#realJSOP15-May-11 0:32 

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.