|
|
What do you mean technology? I'm writing this in C# using the data adapters and all that built into the IDE.
|
|
|
|
|
|
I know that isn't really much help to you - but your query shows your skill level and the answer pitched at that skill level is too long for a forum response.
My general advice is to not rely on wizards and binding until you understand how database interaction works. Then you can decide if wizards and binding are for you (I rejected them because they push me in to really bad designs - they are great for quick demos are conferences to woo the managers, but as a serious tool there is a long way to go yet.)
I'd say that the best advice for you is to get a book on ADO.NET and find out how database interaction actually works rather than rely on wizards and binding.
As a high level answer:
PyroManiak wrote: new form loads (should be on current record, not record 1 which requires the user to navigate back and forth to find the right item.)
From your list box you will know what row you picked. You can use that information when populating the new form in order to get the correct row from the database. I don't know where these back and forward buttons come from. I'd guess it is some crazy wizard (hateful things so they are) that did that for you because it would require a fair bit of skill to write that sort of functionality - based on your question I'm guessing that is currently beyond your ken at the moment.
PyroManiak wrote: I can't figure out how to do this without editing the SQL query to accept a parameter.
I'm assuming you mean parameter on the query - You will always need that if you want only one specific row. The parameter (or parameters) will define the value of the primary key for the row that you want. There is no way of getting around that unless you plan to pull across the entire table (and that is a waste of memory and network bandwidth)
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
What I meant by using a parameter is if I search for "part A" when the new form opens, it only populates the datatable with part a being record 1/1. This doesn't help me when I'm trying to add a new record or delete the current record because the actual table row is n/###.
I'd appreciate an answer reguardless of how complicated it is. I understand the basics of ADO.NET, but that doesn't help when a function I'm looking for doesn't exist by any means I'd think to look for it. Thats no better then asking someone to make a Caesar Salad dressing, and having them screw it up because they didn't know to include anchovy paste, its not their fault for not knowing what isn't there, but that also doesn't mean that they are clueless in cooking.
|
|
|
|
|
I found what I was looking for... there is a .position for the bindingsource and I was able to pass my variable to it and everything works now.
Was that really going to be such a hard answer?
|
|
|
|
|
|
Hi i am having trouble tryin to call a function 4 times in the same statement but with different parameters this is the function
CREATE FUNCTION [dbo].[pr_bll_GetGoalkeeperMarks]
(@PlayerID int,
@Ability nvarchar(120)) returns int
--WITH ENCRYPTION
BEGIN
DECLARE @result int
select @result = case @Ability
WHEN 'Athletic' THEN ScoutingGoalkeeperAthleticAbility.Agility+ScoutingGoalkeeperAthleticAbility.Reactions+ScoutingGoalkeeperAthleticAbility.Bodystrength --Athletic
WHEN 'Character' THEN ScoutingGoalkeeperCharacter.Confidence+ScoutingGoalkeeperCharacter.Bravery+ScoutingGoalkeeperCharacter.Leadership+ScoutingGoalkeeperCharacter.Energetic+ScoutingGoalkeeperCharacter.RiskTaker+ScoutingGoalkeeperCharacter.Talkative+ScoutingGoalkeeperCharacter.Competitive+ScoutingGoalkeeperCharacter.Presence --Character
WHEN 'Tactical' THEN ScoutingGoalkeeperTacticalAbility.Vision+ScoutingGoalkeeperTacticalAbility.Awareness+ScoutingGoalkeeperTacticalAbility.Anticipation+ScoutingGoalkeeperTacticalAbility.StartingPosition --Tactical
WHEN 'Technical' THEN ScoutingGoalkeeperTechnicalAbility.Handling+ScoutingGoalkeeperTechnicalAbility.Crosses+ScoutingGoalkeeperTechnicalAbility.ShotStopping+ScoutingGoalkeeperTechnicalAbility.KickingDeadBall+ScoutingGoalkeeperTechnicalAbility.KickingHands+ScoutingGoalkeeperTechnicalAbility.Distribution+ScoutingGoalkeeperTechnicalAbility.BackPasses+ScoutingGoalkeeperTechnicalAbility.Positioning+ScoutingGoalkeeperTechnicalAbility.CommandOfArea+ScoutingGoalkeeperTechnicalAbility.Sweeping+ScoutingGoalkeeperTechnicalAbility.ComingOffLine --Technical
end
from
ScoutingReport sr
Join Person p on p.Id = sr.ScoutID
left join ScoutingDefenderTechnicalAbility on ScoutingDefenderTechnicalAbility.ScoutingReportID = sr.Id
left join ScoutingForwardTechnicalAbility on ScoutingForwardTechnicalAbility.ScoutingReportID = sr.Id
left join ScoutingGoalkeeperAthleticAbility on ScoutingGoalkeeperAthleticAbility.ScoutingReportID = sr.Id
left join ScoutingGoalkeeperCharacter on ScoutingGoalkeeperCharacter.ScoutingReportID = sr.Id
left join ScoutingGoalkeeperTacticalAbility on ScoutingGoalkeeperTacticalAbility.ScoutingReportID = sr.Id
left join ScoutingGoalkeeperTechnicalAbility on ScoutingGoalkeeperTechnicalAbility.ScoutingReportID = sr.Id
left join ScoutingMidfielderTechnicalAbility on ScoutingMidfielderTechnicalAbility.ScoutingReportID = sr.Id
left join ScoutingOutfieldAthleticAbility on ScoutingOutfieldAthleticAbility.ScoutingReportID = sr.Id
left join ScoutingOutfieldCharacter on ScoutingOutfieldCharacter.ScoutingReportID = sr.Id
left join ScoutingOutfieldTacticalAbility on ScoutingOutfieldTacticalAbility.ScoutingReportID = sr.Id
where
sr.ScoutedPersonId = @PlayerId and
sr.type=0
return @result
END
playerid and ability parameters are passed in and a count of that ability for that player is passed back it works fine when the statement doesnt try to get the average of each ability but when this is included the results are the same for each of the four calls im just wondering if anyone has any idea why this is happenin thanks in advance
select avg(dbo.pr_bll_GetGoalkeeperMarks(scoutedPersonID, 'Athletic')) as 'Athletic',
avg(dbo.pr_bll_GetGoalkeeperMarks(scoutedPersonID, 'Character')) as 'Character',
avg(dbo.pr_bll_GetGoalkeeperMarks(scoutedPersonID, 'Tactical')) as 'Tactical',
avg(dbo.pr_bll_GetGoalkeeperMarks(scoutedPersonID, 'Technical')) as 'Technical',
avg(dbo.pr_bll_GetPlayerTotalMarks(scoutedPersonID))
from scoutingreport sr
Where sr.type = 0
And ScoutId = 11619
And sr.Position in (Select ID From ScoutingPosition Where PositionGroup = 0)
-- modified at 6:45 Wednesday 28th June, 2006
|
|
|
|
|
|
yes but it is commented out so i presume its havin no effect
|
|
|
|
|
|
ya thanks for the advice but that doesnt really help me with my problem does it
|
|
|
|
|
tadhg88 wrote: ya thanks for the advice but that doesnt really help me with my problem does it
If you're looking for help, politeness goes a long way - rudeness gets nowhere.
Colin Angus Mackay knows as much about SQL as anyone I've seen on The Code Project. I'd be nice to him if I were you.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
|
my apologies i read my post again today and it was a little rude so thanks for takin the time to even try to help IT IS appreciated
|
|
|
|
|
Have you tried to Group By scoutedPersonID ?
Also, you have 'Tactical' as the second parameter for both the Athletic and Tactical columns. I assume that is not your intention.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
if i group by scoutedpersonid it will give me averages for each player but i want all players that were scouted by a specific scout and get the average of these
|
|
|
|
|
I'm not sure I understand the need for a function in this case. Couldn't you just make a view called vewScoutTotals:
select sr.ScoutedPersonId, sr.ScoutID, ScoutingGoalkeeperAthleticAbility.Agility +ScoutingGoalkeeperAthleticAbility.Reactions <br />
+ScoutingGoalkeeperAthleticAbility.Bodystrength as Athletic,<br />
ScoutingGoalkeeperCharacter.Confidence +ScoutingGoalkeeperCharacter.Bravery +ScoutingGoalkeeperCharacter.Leadership +ScoutingGoalkeeperCharacter.Energetic +ScoutingGoalkeeperCharacter.RiskTaker +ScoutingGoalkeeperCharacter.Talkative +ScoutingGoalkeeperCharacter.Competitive +ScoutingGoalkeeperCharacter.Presence as Character, ScoutingGoalkeeperTacticalAbility.Vision +ScoutingGoalkeeperTacticalAbility.Awareness +ScoutingGoalkeeperTacticalAbility.Anticipation +ScoutingGoalkeeperTacticalAbility.StartingPosition as Tactical,<br />
ScoutingGoalkeeperTechnicalAbility.Handling +ScoutingGoalkeeperTechnicalAbility.Crosses +ScoutingGoalkeeperTechnicalAbility.ShotStopping +ScoutingGoalkeeperTechnicalAbility.KickingDeadBall +ScoutingGoalkeeperTechnicalAbility.KickingHands +ScoutingGoalkeeperTechnicalAbility.Distribution +ScoutingGoalkeeperTechnicalAbility.BackPasses +ScoutingGoalkeeperTechnicalAbility.Positioning +ScoutingGoalkeeperTechnicalAbility.CommandOfArea +ScoutingGoalkeeperTechnicalAbility.Sweeping +ScoutingGoalkeeperTechnicalAbility.ComingOffLine as Technical<br />
from<br />
ScoutingReport sr<br />
Join Person p on p.Id = sr.ScoutID<br />
left join ScoutingDefenderTechnicalAbility on ScoutingDefenderTechnicalAbility.ScoutingReportID = sr.Id<br />
left join ScoutingForwardTechnicalAbility on ScoutingForwardTechnicalAbility.ScoutingReportID = sr.Id<br />
left join ScoutingGoalkeeperAthleticAbility on ScoutingGoalkeeperAthleticAbility.ScoutingReportID = sr.Id<br />
left join ScoutingGoalkeeperCharacter on ScoutingGoalkeeperCharacter.ScoutingReportID = sr.Id<br />
left join ScoutingGoalkeeperTacticalAbility on ScoutingGoalkeeperTacticalAbility.ScoutingReportID = sr.Id<br />
left join ScoutingGoalkeeperTechnicalAbility on ScoutingGoalkeeperTechnicalAbility.ScoutingReportID = sr.Id<br />
left join ScoutingMidfielderTechnicalAbility on ScoutingMidfielderTechnicalAbility.ScoutingReportID = sr.Id<br />
left join ScoutingOutfieldAthleticAbility on ScoutingOutfieldAthleticAbility.ScoutingReportID = sr.Id<br />
left join ScoutingOutfieldCharacter on ScoutingOutfieldCharacter.ScoutingReportID = sr.Id<br />
left join ScoutingOutfieldTacticalAbility on ScoutingOutfieldTacticalAbility.ScoutingReportID = sr.Id<br />
where sr.type=0 <br />
and sr.Position in (Select ID From ScoutingPosition Where PositionGroup = 0)
To get averages for everyone scouted by a particular scout:
select avg(athletic) as athletic,avg(character) as character,avg(tactical) as tactical<br />
from vewScoutTotals<br />
where ScoutID = 11619
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
yes that wud work but to be honest i just wanted to get a bit of experience with functions so i said id try and use them, ran into trouble and cud not understand why it wudnt work(still dont infact) but i guess i never will now
|
|
|
|
|
tadhg88 wrote: i just wanted to get a bit of experience with functions so i said id try and use them, ran into trouble and cud not understand why it wudnt work
Oh. Well, I too am mystified over the AVG() oddity. Sorry I have no answer for it. Maybe Colin can explain it to us when he gets a little more free time.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
yes i think mystified is the best way to describe it but thanks anyway
|
|
|
|
|
Hi Friends,
I need to run a stored procedure to show the results in my crystal report.
I have just sql server and crystal report.
My problem is, I dont want my users to run that procedure manually can any one help me how can i runt that stored prodedure b4 the user runs crystal reports to get result from my Stroed procedure.
Thanks
Naveed Kamboh
-- modified at 7:09 Monday 26th June, 2006
|
|
|
|
|
Naveed Kamboh wrote: I dont want my users to run that procedure manually
Stored procedures are run from within the program code. Users don't just run them. Don't completely understand your question
|
|
|
|
|
I have a stored procedure in SQLServer which inserts new employee records in a table.
Now i want to be able to insert a small image in the table as well, i can add an image if i use a simple ADO recordset but how do i do it in a stored procedure
Any help in any direction will be much appreciated
i could discard StoredProc and use Recordsets to add records but i would really not
You know you're obsessed with computer graphics when you're outside and you look up at the trees and think, "Wow! That's spectacular resolution!"
Only kings, presidents, editors, and people with tapeworms have the right to use the editorial "we."
|
|
|
|
|
Create a parameter of type image . Use the Parameters collection to pass parameters to your stored procedure (you should be using this anyway). The corresponding Parameter object should be of type adLongVarBinary . Set the parameter's Size to the amount of data you intend to pass, then use AppendChunk to set the data.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|