|
Thank you man , my mistake it wasnt Attribute code column it was supposed to be Lis_Key. remember yesterday we did the Attribute code, thanks a lot man for you time, i will rate you as my mentor
kind regards
Vuyiswa
Vuyiswa
|
|
|
|
|
Hello
VS 2005
I am using typed dataset in my vb project.
In my window the user will insert a new customer
TA_Customer.insert(,,,,,,,)
but if they change their mind and decide they don't want to insert a new one. Is it possible to roll back the changes.
The customer wants be able to add a new customer, then if they change their mind, click close on the window and not commit the changes.
Many thanks for any ideas or code,
Steve
|
|
|
|
|
I think the best you can do is to allow them to delete a new customer. I don't think you want to hold open any transactions on a customer table.
Ben
|
|
|
|
|
Hello,
Thanks for your reply.
I was thinking of holding the data in the memory of the typed dataset then clearing this if they decided to close the form.
Any ideas about the above.
Steve
|
|
|
|
|
In the dataset there is something called AcceptChanges(). You have to call this for any changed to be accepted. The problem is without doing this I am not sure that the data will show up anywhere. I guess, if you are just planning on having data in memory you can do that, but things can get pretty bad if you start assigning id's. You can start to run into situations where two people have the app open and both create a new customer, both get assigned the same id. Now you have a problem.
Ben
|
|
|
|
|
<br />
SELECT [DrawID],<br />
COALESCE(CA.[ForeName], 'Not drawn') As Winner,<br />
FROM Draws D<br />
INNER JOIN CompetitionA CA<br />
ON D.WinnerA = CA.CompAID<br />
WHERE CompID = @CompID<br />
ORDER BY DrawnOn ASC;<br />
I am using the following code as above. It does work but not properly. There are three rows that I would like to return from the database but I only get one. I know the reason for this is because only one of them has been given a 'D.WinnerA' value. The other rows will get this value in time but at the moment they do not have it. Therefore the line:
<br />
INNER JOIN CompetitionA CA<br />
ON D.WinnerA = CA.CompAID<br />
is ruling two of the three required rows out. What is the best approach to this problem?
Thanks in advance
|
|
|
|
|
Change the INNER JOIN to a LEFT JOIN .
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Great thanks for that. Iv'e neaver really fully understood the other JOIN methods. What is the exact reason for using LEFT JOIN? Strictly for this reason?
Thanks
|
|
|
|
|
It is. Basically they work like this (assuming that you have two tables A and B):
SELECT * FROM A
INNER JOIN B
ON A.ID = B.FKID This returns records where there is a match in both A and B.
SELECT * FROM A
LEFT JOIN B
ON A.ID = B.FKID This returns ALL records from A regardless of whether or not there is a matching record in B. Similarly, RIGHT JOIN returns all records from B regardless as to whether or not there is a matching entry in A.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Oh i see. That makes alot of sense i guess. Thanks for that
|
|
|
|
|
|
I should have realised that you would have a summary somewhere. Nice one.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Am now Searching certain range in a character string Attrib_Code,
which has more Characters Example 019600197/1/R.PV000000. i have more than 50 thousand recards with the same First Four numbers. they differ from "00197", the other parts are not important for me. i want to search a range from "000197" till "000274", how do i search the rages in strng? inside substring.?
Vuyiswa
|
|
|
|
|
try this
SELECT * FROM tblA
WHERE cast(substring(Attrib_Code, 5, 5) as bigint) between 197 and 274
Regards
KP
|
|
|
|
|
select * from property
where Cast(Substring(Attrib_code,5,5) as bigint)
between 00274 And 01189 Man the Code works thanks man, i forgort to ask you something again, the is a Column , i need to Extract those who are in Extension 6, i tried extent the query but i get a lot of errors, your experience will help.
Thanks man
Vuyiswa
|
|
|
|
|
not getting.
Can you please explain in detail.
Regards
KP
|
|
|
|
|
Hi All,
I have written a stored procedure to execute common queries where we need all data from a table or with some clause, like this
CREATE PROCEDURE dbo.GetAll
(
@SQLQuery nvarchar(max)
)
AS
SET NOCOUNT ON
EXEC sp_executesql @SQLQuery
THIS PROECDURE WILL ACCEPT QUERY WITH WHERE CLAUSE ETC, Please suggest me if this one is good solution using stored proc, as you can see i used sp_executesql to execute query for caching query plan etc,,, suggest better one .. or if this is fine please let me know.
Many thanks,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
I really don't know where to start here. This type of dynamic SQL is really really bad because it represents a huge gaping security flaw in the application. Imagine if a query managed to get through with the following in:
DELETE sysobjects; You can probably see how this is bad. I suggest that you read the following article by Colin; http://www.codeproject.com/cs/database/SqlInjectionAttacks.asp[^]
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Wow! This is a SQL Injection Attackers heaven.
|
|
|
|
|
Beyond the obvious security problems and general 'why'-ness of this code, why would you even bother wrapping a call to one procedure in another procedure that takes the same parameters....??
adnanrafiq wrote: caching query plan
But the select (and therefore the query plan) are going to change each time...
This makes my head hurt...
|
|
|
|
|
Thanks for Repley and for correcting me.
But the select (and therefore the query plan) are going to change each time...
Yes you are write, but there is caching of query plan, if i give the select statement in stored procedure string variable and pass only the where clause paramerter values but in this case i am doing this beucase in my search criteria user where clause vary on its selection..
What query you guys will suggest in this case:
Skill table has following fields: SkillName , SkillExperience
All skills are listed in listbox and user wants to search those profiles who have 2 years experience in ASP.Net and 3 years in Java, ......
http://msdn2.microsoft.com/en-us/library/ms188001.aspx[^]
And One more thing, if i do validation on server side to prevent the maliciaous attacks, as suggested in the Colin article, like filtering sql query only for select statment.
Then does it do work or still its top bad solution.
Sorry in Advance for bad English.
Many Thanks,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
Hi All,
I have created a DTS in SQL-server 2000 by using design wozard. It has transformation for importing data from a ".csv" file into a SQL-server database table. Its doing well.
Now I would like to change the source and destination od this DTS, how can I reset the source and destination connection properties at runtime.
Pls. help me, give me code snippet if possible.
Thank you,
Regards,
Aleem.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
I have the duplicate data in the table how could i retrieve them. ex: the name field is like
1. xyz
2. abc
3. xyz
4. pqr
5. abc
6. ijk
7. mno
here I want only the duplicate records. What is the query?
Thanx in advance.
yamini
|
|
|
|
|
select name FROM tblA GROUP BY name HAVING count(name) > 1
Regards
KP
|
|
|
|
|