|
Thank you all for replying. I have solved this problem. It is as someone had said, you can't create a song before you have a singer.
|
|
|
|
|
Yes, which is very limiting, no?
|
|
|
|
|
PIEBALDconsult wrote: Yes, which is very limiting, no?
Yes, it is. But that was not his original question, it was about referential integrity. So his statement can be rewritten as
you can't create a song before you have singers.
|
|
|
|
|
Shameel wrote: you can't create a song before you have singers. Don't be shocked too much, but I lied (just a little bit). Of course it's possible with the correct schema;
Id | SongWriter |
---|
1 | Paul McCartney | 2 | Mick Jones |
Song | WrittenBy |
---|
1 | A world without love |
You can't have a singer sing a song before the song is written .
Creating a table-structure can be hard; a schema that has already been tried and used by a coworker, is a schema that has probably been tested by the co-workers user-base. Meaning, there's little chance that his code contains errors.
..and sometimes, you have to answer beyond the scope of the question. That must be what I enjoy most of the forums; reading strange questions and strange answers that make you go "hmz". Sometimes one can add a helpful answer, sometimes it's merely a waste of time. The most interesting discussions often start with "care to explain" or "why do you.."
Do keep up the good work and keep answering questions; not only will it have saved a few people quite some time and frustration, it's also a very efficient way of learning.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
ok, I get you. I made a pretty bad assumptions that the singer is the writer.
Eddy Vluggen wrote: Do keep up the good work and keep answering questions; not only will it have saved a few people quite some time and frustration, it's also a very efficient way of learning.
I agree. I started learning many things when I started answering questions here. Helping others is a great way of learning.
|
|
|
|
|
Shameel wrote: the singer is the writer
I don't think the OP is concerned with the writer at all.
And if he wanted to track writers he would still be best served by a many-to-many schema.
|
|
|
|
|
Right, but the cause of the problem is a limiting schema. He wanted to create a song before he had singers, therefore the schema was the problem, not the code.
A better schema allows one to add either first and then associate them later. And furthermore, his way requires you to add duplicates of a song that is performed by many singers -- which is bad.
|
|
|
|
|
Hi
string conn = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
MySqlConnection con = new MySqlConnection(conn);
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = con;
cmd.CommandText = "Insert_Image";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("?description", SqlDbType.VarChar).Value = txtdesc.Text;
cmd.Parameters.AddWithValue("?fullstr", SqlDbType.VarChar).Value = path;
con.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
Session.RemoveAll();
My code is giving error at executenonquery, "Input string not in correct format". The values in path and txt dec are correct.
Can you please tell where i am wrong?
Regards
Inderjeet Kaur
Inderjeet Kaur
Sr. Software Engg
|
|
|
|
|
The AddWithValue method expects the actual value to be passed rather than the data types, so you should write something like:
cmd.Parameters.AddWithValue("?description", txtdesc.Text);
|
|
|
|
|
Thanks alot!
I am new to MY SQL database and my problem is solved.
Inderjeet Kaur
Sr. Software Engg
|
|
|
|
|
You're welcome.
However, this problem isn't related to My SQL in any way, rather it is to do with ADO.NET.
|
|
|
|
|
When I use MySQL I use an at (@), not a question mark (?) -- I thought that was the problem, does it work with the question mark?
|
|
|
|
|
Dunno, but it works without any mark too. I only use the @-sign within the Sql-statement, the AddWithValue method always without.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
i am new to databse design. i want to design a schema for my bug tracking project . dont know how to start !!
plz help
Himanshu.
himanshu_1002@yahoo.com
Himanshu
|
|
|
|
|
This[^] may help you to start.
Niladri Biswas
(Code Project MVP 2012)
|
|
|
|
|
thanks Niladri.. this was helpful
|
|
|
|
|
|
Learn to Normalize. A simple set of rules that can be applied to any collection of facts, and which results in a relational and normalized dataset.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Dear all,
I'm new comer in SQL, I have problem in web development, in my system there is searching for phonetic name like nielsen and nelson. Example:
If I enter test word 'nielsen' then output can be 'nilsen','nelson'. I've used sounds like but it given so many return and the return have far distance with test word. Also I have implemented it with traditional way, but the searching running slow, I compare some data (from excel, the number of data 200 record) with database record about 600.000 record.Does anyone have idea with my problem?Or have implement this case? Thank you for helping..
|
|
|
|
|
As you haven't said what the database is, I'm going to assume you are talking about SQL Server. Most "real" databases provide a SOUNDEX[^] function which can be used to do this form of matching.
|
|
|
|
|
Hi nagy,
Thank you for your answer, I used MY SQL, and I've used soundex, but it return too many result which not match to my keyword, how about you idea bro?
Thank you,
Regards.
|
|
|
|
|
Please try out this Code Project Article[^]. It has a total of 6 parts and the current one handles your situation.
Also you can try out with Metaphone approach which performs better that Soundex. Here[^] is an implementation for the same.
Hope that helps
Niladri Biswas
(Code Project MVP 2012)
|
|
|
|
|
Hi Niladri,
Thank you for your answer.. I want to, can that solution if we want to compare 100 data in table a with 100000 data in table b. so it looks like google search, when program compare 1 data to 1000, the system doesn't compare to all data, but only similar data, and the system give return hit, example: 1 data is suspected similar with 8 data in table b. Can the solution solve the problem niladri?
Thank you,
Regards
|
|
|
|
|
Morning all. I need to select certain data from a table:
PI JobID FormID ShiftID StartEvent SW SG End Event EG EW
3 9249 36208 6241 2010-08-14 10:00:15.610 0 0 2010-08-14 10:14:52.000 143 109
3 9249 36208 6241 2010-08-14 10:14:52.217 109 143 2010-08-14 10:15:04.000 150 109
3 9249 36208 6241 2010-08-14 10:15:04.763 109 150 2010-08-14 10:15:07.000 150 109
3 9249 36208 6241 2010-08-14 10:15:09.820 109 150 2010-08-14 10:29:15.000 150 221
3 9249 36208 6241 2010-08-14 10:29:15.570 221 150 2010-08-14 10:53:09.000 376 300
3 9249 36208 6241 2010-08-14 10:53:09.240 300 376 2010-08-14 11:01:18.000 4294 1824
3 9249 36208 6241 2010-08-14 11:01:18.553 1824 4294 2010-08-14 11:02:06.000 4294 1942
3 9249 36208 6241 2010-08-14 11:02:06.363 1942 4294 2010-08-14 11:02:14.000 4294 1920
Out of this I need to get the start values and the end values, ignoring everything in between, essentially reducing it to this:
PI JobID FormID ShiftID StartEvent SW SG End Event EG EW
3 9249 36208 6241 2010-08-14 10:00:15.610 0 0 2010-08-14 11:02:14.000 4294 1920
Any help will be much appreciated.
-edited to show that min and max values on SW, SG, EG, and EW may not necessarily work
modified 20-Aug-12 12:32pm.
|
|
|
|
|
Try this ...
select PI,JobID,FormID,ShiftID,Min(StartEvent),Max(End Event)
from someTable
group by PI,JobID,FormID,ShiftID
|
|
|
|