|
|
hello... could someone give me the necessary codes for this project..
I really need it.
the system must automatically receive fax data from 3 modem simultaneously and allows the user to save, edit, delete and print those faxes,
also those faxes when receive must be in image form..
thanx...
ginji amano
|
|
|
|
|
I have 3 tables students, courses and courses_tables. The thing I don't understand is that do i need to have student_id as a Foreign key in courses table. Secondly, what kind of key i need to define in the courses_taken table. I am thinking of a composite primary key of std_id and course_id inside the courses_taken table but that doesn't make sense for me too. The reason being is that shouldn't student be allowed to take the same course again. What do you think that how many primary keys i need to have in these 3 tables and Foreign keys.
Thanks
CREATE TABLE STUDENTS
(
std_id int not null identity,
std_name varchar(50) not null,
std_program varchar(20) not null,
std_email varchar(50) not null unique,
constraint std_id_pk PRIMARY KEY(std_id)
)
CREATE TABLE COURSES
(
course_id int not null identity,
course_name varchar(50) not null unique,
std_id_fk int references STUDENTSRK(std_id)
constraint course_id_pk primary key(course_id)
)
CREATE TABLE COURSES_TAKEN
(
std_id int not null,
course_id int not null,
section_id varchar(10) not null,
semester varchar(20) not null,
mark int not null,
)
|
|
|
|
|
According to my knowledge you don't need the std_id_fk in the Courses Table as a foreign key.
coz that doesn't makes any sense...you can have only 10 courses, but if u keep the std_id as foreign key, you will have same course names with different course id's, which is redundant.
you can just create a composite primary key of std_id and course_id, that's all.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
I think the primary keys should be unique ids, not combinations of ids. I think the important thing is foreign keys for refernetial integrity I also think you should have asked in the SQL forum.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
That's what i thought too that i don't need std_id_fk foreign key in courses table but what about the Courses_Taken table, if i make it a composite key std_id and course_id then a student cannot take the same course again am i right. is there any relation of courses_taken table with any other table or am just overloading my brain. Thanks
|
|
|
|
|
yes, a student cannot take the same course again...and that is correct, a student shud be allowed to take a course only once.
Y would u want him to take the same course again?
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Y wouldn't you what if a student wants to upgrade his marks by re-taking the same course again.
|
|
|
|
|
But then the term wud be changed, rite?
he cannot take the same subject twice in the same term.
So you shud also maintian the term for which the student has selected the subjects.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
hello!!!
could someone tell me what's the problem with my code..
i got this code from www.homeandlearn.co.uk..
I got some error when I edited the records on drow2[1] it says<code>syntax error in update statement</code>
<code>
//for update
System.Data.Oledb.OledbCommandBuilder cb;
cb = new System.Data.Oledb.OledbCommandBuilder(da);
System.Data.DataRow drow2 = ds1.Tables["login"].Rows[inc];
drow2[0] =textbox1.Text;
drow2[1] =textbox2.Text;
d.Update(ds1,"login");
</code>
thanks;
Ginji Amano
|
|
|
|
|
I don't see an update statement.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
d.update(ds1,"login")
actually its da.updte(ds1,"login");
this is all it need to update according to the tutorial
|
|
|
|
|
Hello everyone,
In my sample below, abcd is out parameter. I think it only reduces the value copy from input parameter of caller (Main), and it does not reduces value copy from instance returned from DateTime.Now to abcd (assignment), correct?
(in more details when we do assignment abcd = DateTime.Now, a new instance will be created, and value copied from DateTime.Now return instance, and making abcd point to the new instance?)
static void Test2(out DateTime abcd)
{
abcd = DateTime.Now;
}
static void Main(string[] args)
{
DateTime abcd;
Test2(out abcd);
return;
}
thanks in advance,
George
|
|
|
|
|
Why do you keep asking this sort of questions ? Seriously....
As previously discussed, DateTime.Now creates a new value, which is assigned to abcd. out and ref are the same in MSIL, the C# compiler enforces out.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
This is not the same as the question I asked before. I just use a common scenario to ask another totally different question.
Christian Graus wrote: DateTime.Now creates a new value
Yes, this is what I understand and we agree. I am not asking this.
What I am asking is how C# will treat with assignment with out variable. In my sample, at least I could think of two scenarios of how C# compiler implements this,
- making out variable pointing to the new instance returned by DateTime.Now directly;
- making a value copy from the new instance returned by DateTime.Now to another new instance, and making abcd pointing to the "another new instance".
Any ideas?
regards,
George
|
|
|
|
|
?You can always read the MSIL to answer these sort of questions. My vote is on option 1, tho.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian!
Here is the IL code I got. I think you are correct. Using stobj will make a value copy, right?
.method private hidebysig static void Test2([out] valuetype [mscorlib]System.DateTime& abcd) cil managed
{
.maxstack 8
L_0000: nop
L_0001: ldarg.0
L_0002: call valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::get_Now()
L_0007: stobj [mscorlib]System.DateTime
L_000c: ret
}
regards,
George
|
|
|
|
|
George_George wrote: making a value copy from the new instance returned by DateTime.Now to another new instance, and making abcd pointing to the "another new instance".
Why would anyone want to do it this way?
|
|
|
|
|
Thanks Senthil,
Out variable saves value copy on stack if the value type is big.
Anyway, any comments or answers to my original question?
regards,
George
|
|
|
|
|
George_George wrote: Out variable saves value copy on stack if the value type is big.
Yes, it does. I was questioning your 2nd mechanism of implementing of the copy.
And yes, you got it right. out parameters are like pointers in C/C++.
void Method(int *p)
{
int x = 20;
*p = x;
}
void G()
{
int y = 10;
Method(&y);
}
|
|
|
|
|
Thanks Senthil,
1.
Sorry my English is not good. I think you mean out variable only affects function call behavior (passing pointer other than passing a value copy), not affecting assignment, correct?
2.
In my second approach, I mean we can change the pointer value of the out variable passed in, and making the pointer pointed to the instance created by DateTime.Now, so that there is no need to make another value copy from the instance created by DateTime.Now to another instance (and making abcd point to the "another instance"). Have I made myself understood?
regards,
George
|
|
|
|
|
George_George wrote: Sorry my English is not good. I think you mean out variable only affects function call behavior (passing pointer other than passing a value copy), not affecting assignment, correct?
Yes.
George_George wrote: no need to make another value copy from the instance created by DateTime.Now to another instance (and making abcd point to the "another instance")
Yes.
|
|
|
|
|
Thanks Senthil,
Question answered.
regards,
George
|
|
|
|
|
George
As CG said, you are asking a lot of similar questions. Perhaps now would be a good time to start reading/studying/learning the C# and CLR Emca specifications. If it is plentiful, unambiguous information you are after (who isnt? ), then that would be a good too look at. Chances are better to get the correct answer there, than simply relying on word of mouth.
Cheers
leppie
|
|
|
|
|
Hi,
I have a requirement for a project to have a button on a webform which once pressed will switch to a running Winforms app (not in .NET) and send keys e.g. Alt S. I imagine that this is going to require ActiveX, can someone just confirm that this is the correct approach?
Thanks
|
|
|
|