Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Server Syntax not fast enough for Crystal Reports .NET

Posted on 2010-08-19
8
Medium Priority
?
261 Views
Last Modified: 2012-06-21

Good Day:

I am using SQL Server 2000 for a VB.NET application.

The following script works great when I manually execute the first Delete Script, wait a minute and then execute the second Insert Script.  If I do not wait then it reports my old data instead of the new data.  In other words, SQL Server does not process the data fast enough for the Crystal Reports document.  Is there a way to fix this because I need to automate the process by using a stored procedure?  

---Delete Script
BEGIN TRAN
DELETE FROM PackSlip
WHERE SONumber=@SONumber
COMMIT TRAN

---Insert Script
BEGIN TRAN
INSERT INTO PackSlip
Select * from vwPackSlipCreate
WHERE SONumber=@SONumber
COMMIT TRAN

Sample Data:
PackSlip Table  (Old Data)
Order #:      1234
QtyOrdered:      10
QtyShipped:        5
QtyBO:        5      

PackSlip Table  (New Data)
Order #:      1234
QtyOrdered:      5
QtyShipped:      5
QtyBO:      0        

Any suggestions?
Thanks,
Denise

0
Comment
Question by:DeniseGoodheart
8 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 1000 total points
ID: 33480798
For the delete, make sure there is a good index on PackSlip.SONumber.
Other factors that may affect it are triggers, index updates and indexed views.

For the insert, it looks like you are using a view; maybe the view is not optimized?
Pick an SONumber, and run this in SSMS and check the execution plan (Ctrl-L).

Select * from vwPackSlipCreate WHERE SONumber= 123

If you need help, you can do this and we can check the view performance.
Open a new Query Window, run the tsql below

set showplan_text on;
Select * from vwPackSlipCreate WHERE SONumber= 123

Close the new query window.
0
 
LVL 61

Assisted Solution

by:HainKurt
HainKurt earned 1000 total points
ID: 33480823
after deleting make sure you re select / re run your select query...
there is no way to get the old data unless sql has some select bugs ;)
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 33482248
Does the report have data saved?

How are you running the report?

mlmcc
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 11

Expert Comment

by:mattibutt
ID: 33482862
2000 is 10 years old vb itsel is a slow language
0
 

Author Comment

by:DeniseGoodheart
ID: 33604095
mattibutt:

Yes I undestand 2000 is 10 years old but it is easier to use than 2005 and 2008 because the GUI changed.  I will upgrade to SQL 2008 when we are ready to go into production.  VB.NET is a slow  language compared to what other lanuages?
0
 

Author Comment

by:DeniseGoodheart
ID: 33604101
mlmcc:

I'm using Crystal Reports.NET
0
 

Author Comment

by:DeniseGoodheart
ID: 33604116
Hi All,

I did a quick fix to fix this  problem, but now I am getting the same problem in another stored procedure.  It might  be that I need to extend my connection time on VB.NET.  I will try this and if it does not work, then I will post a new thread.

Thanks
0
 

Author Closing Comment

by:DeniseGoodheart
ID: 33604122
It did not fix the problem, but they did give me valuable information.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question