Showing posts with label records. Show all posts
Showing posts with label records. Show all posts

Friday, March 30, 2012

having trouble connecting to database

Hi I am new at this.

I have a little program written in C# in asp.net. The program basically accesses a database and stores new records. The database is supposedly already attached to MSDE so I am able to see the tables of the database inside asp.net. I can click on the individual slots of the table and modify the datas manually. However, I want to connect to the database from my C# program and be able to input data into the database via the website that the C# program produces. After I type in the data into the website and click the submit button on the website, I get an error page that says this:

Login failed for user 'sa'

the line of code thats causing this error is:

con =

new SqlConnection("data source=(local)\\NetSdk; initial catalog=Friends; user id=sa");

Why is it not able to connect to the database?

YourChild:


con =

new SqlConnection("data source=(local)\\NetSdk; initial catalog=Friends; user id=sa");



I am taking the liberty to presume that your database name is Friends.I just couldn't figure what the "\\NetSdk" means. Perhaps you can addsomething to my knowledge.

Most probably if you aren't using Integrated Security for accessing thedatabase, you'd need to specify the password in the connection stringas well. You can make it something like this:

con =new SqlConnection("data source=(local);initial catalog=Friends;user id=sa;pwd="yourpassword")
Remember,it is a bad habit to store your connection string in the code. Tryputting it in the web.config, but you might want to do this later, whenyou get the hang of things.

Smiles.|||

uXuf:

YourChild:


con =

new SqlConnection("data source=(local)\\NetSdk; initial catalog=Friends; user id=sa");



I am taking the liberty to presume that your database name is Friends. I just couldn't figure what the "\\NetSdk" means. Perhaps you can add something to my knowledge.

Most probably if you aren't using Integrated Security for accessing the database, you'd need to specify the password in the connection string as well. You can make it something like this:

con =new SqlConnection("data source=(local);initial catalog=Friends;user id=sa;pwd="yourpassword")

Remember, it is a bad habit to store your connection string in the code. Try putting it in the web.config, but you might want to do this later, when you get the hang of things.

Smiles.

Thank you it works! I'm so glad you came by! now I am in the process of trying to stick the 'userName' and 'password' into the web.config file by using:

<

identityimpersonate="true"userName="sa"password="mypassword"/>

only now when I hit compile, Windows is giving me an error that says:

"Unable to start debugging on the web server. Server side-error occurred on sending debug HTTP request." Do I need to change something else to make this work?

There is another piece of code at the top of the web.config file that looks like this:

<authenticationmode="None"/>

Should "None" be set to "Windows"?

Then there is another username and password inside the "Directory Security" in IIS via 'property' for the virtual directory corresponding to the directory of the project. Is this username and password associated with the userName and password used to access the database?

Wednesday, March 28, 2012

Having major problems with my insert query logic

I have a perl program that is looping through a hash of a hash. I need to Update any existing records but also insert any new records in the table using collected data in the hash.

Life would be very simple if it was possible to use a Where Clause in an Insert statement but not does not work.

Here is some example code from my program:
sub Test{
foreach my $table(keys %$HoH){
foreach my $field(keys %{$HoH->{$table}}){
if($table eq "CPU"){
my $CPUstatement = "INSERT INTO CPU(CPUNumber, Name, MaxClockSpeed, SystemNetName)
Values ('$field',
'$HoH->{CPU}{$field}{Name}',
'$HoH->{CPU}{$field}{MaxClockSpeed}' ,
'$HoH->{Host}{SystemNetName}')";
print "$CPUstatement\n";
if ($db->Sql($CPUstatement))
{
print "Error on SQL Statement\n";
Win32::ODBC::DumpError();
}
else
{
print "successful\n";
}
}
}


}
}

Thanks,
LauraI'm assuming that your hash values are printing as expected. The construction looks strange (but it could be fine) to me.

Is the CPUNumber the primary key for the CPU table? If so, you could use something like:my $CPUstatement = "IF EXISTS (SELECT * FROM CPU WHERE CPUNUMBER = '$field')
THEN UPDATE CPU
SET Name = '$HoH->{CPU}{$field}{Name}'
, MaxClockSpeed = '$HoH->{CPU}{$field}{MaxClockSpeed}'
, SystemNetName = '$HoH->{Host}{SystemNetName}'
WHERE CPUNumber = '$field'
ELSE INSERT INTO CPU(CPUNumber, Name, MaxClockSpeed, SystemNetName)
Values (
'$field'
, '$HoH->{CPU}{$field}{Name}'
, '$HoH->{CPU}{$field}{MaxClockSpeed}'
, '$HoH->{Host}{SystemNetName}')";-PatP|||I tried your code and I am getting an error -> Incorrect Systax near the keyword 'THEN'

What do you suppose that means? I copied and pasted the code as is.

Thanks,
Laura|||That error means that I don't proofread very well ;) I was composing as I typed, and simply got ahead of myself then didn't clean up afterwards. Just remove the word THEN from that statement. Sorry.

-PatP|||oh wow. That's so cool, it worked.

Thanks Pat for your help. I learn new things everyday.

-Laura|||I just love it when I can make a lovely lady happy!

-PatP

Monday, March 26, 2012

HAVING Clause has no effect

I have this stored procedure. I want to run a few simple SQL functions against my tables. In particular I want to take a subset of records (One or Two years worth) and calculate AVG, VAR and STDEV.

It does not work the way I thought it would. I end up with the whole input table in #tempor1 which is about 6 years worth of records.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER OFF

GO
ALTER PROCEDURE [dbo].[findAve1YearDailyClose_MSFT]
AS
BEGIN
SET NOCOUNT ON;
SELECT adjClosed, volume INTO #tempor1 FROM dbo.dailyCl_MSFT
GROUP BY dateTimed, adjClosed, volume
HAVING (dateTimed > DATEADD (year, -1, MAX (dateTimed)))

SELECT AVG (adjClosed) AS "AVGAdjClose1Year",
VAR (adjClosed) AS "VARAdjClose1Year", AVG (volume) AS "AVGVolume1Year",
STDEV (volume) AS "STDEVVolume1Year", COUNT (*) AS "total"
FROM #tempor1
END

Thus if I change the number of years I subtract from the latest date from 1 to 2 I end up with the same result. What is the problem?

Thanks.

What about using:

SELECT adjClosed, volume INTO #tempor1
FROM dbo.dailyCl_MSFT
WHERE dateTimed > (SELECT DATEADD(year, -1, MAX (dateTimed)) FROM dbo.dailyCl)
GROUP BY dateTimed, adjClosed, volume


HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

Jens K. Suessmeyer wrote:

What about using:

SELECT adjClosed, volume INTO #tempor1
FROM dbo.dailyCl_MSFT
WHERE dateTimed > (SELECT DATEADD(year, -1, MAX (dateTimed)) FROM dbo.dailyCl)
GROUP BY dateTimed, adjClosed, volume

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

It sure worked! Many thanks for a lesson. Marked as answered!

Thanks.

sql

Having a drilldown report "go back" to original report

Hi,

I have a main/summary report which returns a list of records. Each record on this main report contains a link to a detailed report for more information on that particular record. That all works just fine. But on my detailed report, I want to provide a button to allow the user to easily "go back" to the original report.

I noticed that at the top of my detailed report is a toolbar, with icons to print, search, etc., so this seems like the place where it would be nice to have another icon with the back arrow that would be linked to the original report. The user can use the Back button on the browser, but I think it would be much nicer to provide a Back button on the report itself.

Is there any easy way to go about doing this?
Can anyone give me any pointers?

Thanks,
Beth

The new ReportViewer controls in VS 2005 have this functionality. The button is hidden by default in the ReportViewer web control, but you can enable it by setting ReportViewer.ShowBackButton = true.

|||Oh, my fault - I forgot to mention that I am using SQL Server Reporting Service 2000 and VS 2003.

Is there a different mechanism to use for this configuration?

Thanks,
Beth|||There is no way to do this from within RS 2000.|||Ok, thanks for the info.

Beth|||

One thing I have done is to use a text box on the last report and then then put some text in there, like "Back to Original Report -->" and then navigate to the original report. The users don't seem to mind.

SHP

|||

where to add this code to get the backbutton..Please tell me procedure to add back button by this method..

Thanks a lot.

|||

I've done it on a few of my reports. In my case i save my where clause in a parameter called @.Previous and pass it to the drilldown report. Then in my drilldown report i have a textbox which i have set to call my original report with @.Previous parameter. To make i look more like a button i've given the textbox a picture background.

Basically i am running the original report again and passing it its original parameters. Its not quite like adding a button to the toolbar, but it works. Hope this helps.

|||

Thanks dear. But i know it works at the same time it takes me to the original refreshed report with default parameters. I want the button so that the user can go to the exactly previous page. Also if the back button can appear in the VS then it should come in report manager too.

Please somebody let me know the procedure.

|||

Does anyone know how/where to set the ReportViewer.ShowBackButton = True for reportmanager.

|||While Report Manager does use a version of the viewer control internally, it doesn't expose the viewer API to the end user, so there is no way to enable this button through Report Manager. It is only available on the standalone control.|||

Brian,

Is this something that will be included in a Hotfix / SP? Going back to the parent report by using the Browser back button just causes the parent report to sit there and not process. Obviously a usabilty issue ( I can get around for now by using Jump to URL and forcing a new window to pop-up but it would be better not to have to go that route).

|||

I send my report parameters directly from my UI and pass them all into a parameter called @.Criteria in my report (In my reports i pass @.Criteria into the WHERE clause in the query) ). And this is the parameter i pass to my drill-through report to a parameter @.Previous. My back button then calls the original report with exactly the same parameters (@.Previous is passed into the where clause in the original report).

Of course there is a hard way to do it. Pass all the original report parameters to the drill through report to dummy parameters which aren't used and then when you press the back button send all the same parameters back to get your orginal report.

|||

I'm not sure if this is what everyone is after but perhaps this will help. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1327767&SiteID=1

|||

Dear all

Please provide me the steps to create a drilled down report in report server 2005 . I am a begginer in reportserver ..

regards

Polachan

Having a drilldown report "go back" to original report

Hi,

I have a main/summary report which returns a list of records. Each record on this main report contains a link to a detailed report for more information on that particular record. That all works just fine. But on my detailed report, I want to provide a button to allow the user to easily "go back" to the original report.

I noticed that at the top of my detailed report is a toolbar, with icons to print, search, etc., so this seems like the place where it would be nice to have another icon with the back arrow that would be linked to the original report. The user can use the Back button on the browser, but I think it would be much nicer to provide a Back button on the report itself.

Is there any easy way to go about doing this?
Can anyone give me any pointers?

Thanks,
Beth

The new ReportViewer controls in VS 2005 have this functionality. The button is hidden by default in the ReportViewer web control, but you can enable it by setting ReportViewer.ShowBackButton = true.

|||Oh, my fault - I forgot to mention that I am using SQL Server Reporting Service 2000 and VS 2003.

Is there a different mechanism to use for this configuration?

Thanks,
Beth|||There is no way to do this from within RS 2000.|||Ok, thanks for the info.

Beth|||

One thing I have done is to use a text box on the last report and then then put some text in there, like "Back to Original Report -->" and then navigate to the original report. The users don't seem to mind.

SHP

|||

where to add this code to get the backbutton..Please tell me procedure to add back button by this method..

Thanks a lot.

|||

I've done it on a few of my reports. In my case i save my where clause in a parameter called @.Previous and pass it to the drilldown report. Then in my drilldown report i have a textbox which i have set to call my original report with @.Previous parameter. To make i look more like a button i've given the textbox a picture background.

Basically i am running the original report again and passing it its original parameters. Its not quite like adding a button to the toolbar, but it works. Hope this helps.

|||

Thanks dear. But i know it works at the same time it takes me to the original refreshed report with default parameters. I want the button so that the user can go to the exactly previous page. Also if the back button can appear in the VS then it should come in report manager too.

Please somebody let me know the procedure.

|||

Does anyone know how/where to set the ReportViewer.ShowBackButton = True for reportmanager.

|||While Report Manager does use a version of the viewer control internally, it doesn't expose the viewer API to the end user, so there is no way to enable this button through Report Manager. It is only available on the standalone control.|||

Brian,

Is this something that will be included in a Hotfix / SP? Going back to the parent report by using the Browser back button just causes the parent report to sit there and not process. Obviously a usabilty issue ( I can get around for now by using Jump to URL and forcing a new window to pop-up but it would be better not to have to go that route).

|||

I send my report parameters directly from my UI and pass them all into a parameter called @.Criteria in my report (In my reports i pass @.Criteria into the WHERE clause in the query) ). And this is the parameter i pass to my drill-through report to a parameter @.Previous. My back button then calls the original report with exactly the same parameters (@.Previous is passed into the where clause in the original report).

Of course there is a hard way to do it. Pass all the original report parameters to the drill through report to dummy parameters which aren't used and then when you press the back button send all the same parameters back to get your orginal report.

|||

I'm not sure if this is what everyone is after but perhaps this will help. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1327767&SiteID=1

|||

Dear all

Please provide me the steps to create a drilled down report in report server 2005 . I am a begginer in reportserver ..

regards

Polachan

Having a drilldown report "go back" to original report

Hi,

I have a main/summary report which returns a list of records. Each record on this main report contains a link to a detailed report for more information on that particular record. That all works just fine. But on my detailed report, I want to provide a button to allow the user to easily "go back" to the original report.

I noticed that at the top of my detailed report is a toolbar, with icons to print, search, etc., so this seems like the place where it would be nice to have another icon with the back arrow that would be linked to the original report. The user can use the Back button on the browser, but I think it would be much nicer to provide a Back button on the report itself.

Is there any easy way to go about doing this?
Can anyone give me any pointers?

Thanks,
Beth

The new ReportViewer controls in VS 2005 have this functionality. The button is hidden by default in the ReportViewer web control, but you can enable it by setting ReportViewer.ShowBackButton = true.

|||Oh, my fault - I forgot to mention that I am using SQL Server Reporting Service 2000 and VS 2003.

Is there a different mechanism to use for this configuration?

Thanks,
Beth|||There is no way to do this from within RS 2000.|||Ok, thanks for the info.

Beth|||

One thing I have done is to use a text box on the last report and then then put some text in there, like "Back to Original Report -->" and then navigate to the original report. The users don't seem to mind.

SHP

|||

where to add this code to get the backbutton..Please tell me procedure to add back button by this method..

Thanks a lot.

|||

I've done it on a few of my reports. In my case i save my where clause in a parameter called @.Previous and pass it to the drilldown report. Then in my drilldown report i have a textbox which i have set to call my original report with @.Previous parameter. To make i look more like a button i've given the textbox a picture background.

Basically i am running the original report again and passing it its original parameters. Its not quite like adding a button to the toolbar, but it works. Hope this helps.

|||

Thanks dear. But i know it works at the same time it takes me to the original refreshed report with default parameters. I want the button so that the user can go to the exactly previous page. Also if the back button can appear in the VS then it should come in report manager too.

Please somebody let me know the procedure.

|||

Does anyone know how/where to set the ReportViewer.ShowBackButton = True for reportmanager.

|||While Report Manager does use a version of the viewer control internally, it doesn't expose the viewer API to the end user, so there is no way to enable this button through Report Manager. It is only available on the standalone control.|||

Brian,

Is this something that will be included in a Hotfix / SP? Going back to the parent report by using the Browser back button just causes the parent report to sit there and not process. Obviously a usabilty issue ( I can get around for now by using Jump to URL and forcing a new window to pop-up but it would be better not to have to go that route).

|||

I send my report parameters directly from my UI and pass them all into a parameter called @.Criteria in my report (In my reports i pass @.Criteria into the WHERE clause in the query) ). And this is the parameter i pass to my drill-through report to a parameter @.Previous. My back button then calls the original report with exactly the same parameters (@.Previous is passed into the where clause in the original report).

Of course there is a hard way to do it. Pass all the original report parameters to the drill through report to dummy parameters which aren't used and then when you press the back button send all the same parameters back to get your orginal report.

|||

I'm not sure if this is what everyone is after but perhaps this will help. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1327767&SiteID=1

|||

Dear all

Please provide me the steps to create a drilled down report in report server 2005 . I am a begginer in reportserver ..

regards

Polachan

Wednesday, March 21, 2012

hash table (#) order by problem with more records

We have one single hash (#) table, in which we insert data processing
priority wise (after calculating priority).
for. e.g.

Company Product Priority Prod. QtyProd_Plan_Date
C1 P11100
C1 P22 50
C1 P33 30
C2 P11200
C2 P42 40
C2 P53 10

There is a problem when accessing data for usage priority wise.
Problem is as follows:

We want to plan production date as per group (company) sorted order and
priority wise.

==>With less data, it works fine.
==>But when there are more records for e.g. 100000 or more , it changes
the logical order of data

So plan date calculation gets effected.

==Although I have solved this problem with putting identity column and
checking in where condition.

But, I want to know why this problem is coming.

If anybody have come across this similar problem, please let me know
the reason and your solution.

IS IT SQL SERVER PROBLEM?

Thanks & Regards,
T.S.Negi> when there are more records for e.g. 100000 or more , it changes
> the logical order of data

Are you referring to the perceived order in the table? Rows in tables
have NO logical order in a relational database. If you require a
particular order you have to query them using a SELECT statement with
an ORDER BY clause otherwise the ordering is undefined.

If that doesn't answer your question then please describe your problem
with DDL (including keys), sample data INSERT statements and show your
required end result.

--
David Portas
SQL Server MVP
--|||While inserting records in hash table. It is already order by on some
fields.
But when selecting/updating records, I want the same order of records
should be updated/selected.

"Rows in tables have NO logical order in a relational database"
I think, True for hash(#) and permanent table.

T.S.Negi

David Portas wrote:
> > when there are more records for e.g. 100000 or more , it changes
> > the logical order of data
> Are you referring to the perceived order in the table? Rows in tables
> have NO logical order in a relational database. If you require a
> particular order you have to query them using a SELECT statement with
> an ORDER BY clause otherwise the ordering is undefined.
> If that doesn't answer your question then please describe your
problem
> with DDL (including keys), sample data INSERT statements and show
your
> required end result.
> --
> David Portas
> SQL Server MVP
> --|||There is an update condition. Which I want to make sure, performing on
ordered data (order by used at the time of insert).
I want to avoide loop.

Reason: "Rows in tables have NO logical order in a relational database"
!!!!

So Please advice.
Thanks,
T.S.Negi

Sample SQL:
===========

UPDATE #WK_PDR_ProcessingData SET
@.Opn_Stock_Qty= CASE WHEN (
@.Customer_Cd = Customer_Cd
AND @.Product_No = Product_No
AND @.Product_Site_Cd = Product_Site_Cd
AND @.Assy_Company_Cd = Assy_Company_Cd
AND @.Assy_Section_Cd = Assy_Section_Cd
AND @.Line_Cd = Line_Cd
) THEN @.Opn_Stock_Qty + @.Production_Qty - @.Requirement_Qty
ELSE begin_Stock_Qty END,
Calc_Stock_Qty= @.Opn_Stock_Qty + Production_Qty - Requirement_Qty,
@.Customer_Cd = Customer_Cd,
@.Product_No = Product_No,
@.Product_Site_Cd= Product_Site_Cd,
@.Assy_Company_Cd= Assy_Company_Cd,
@.Assy_Section_Cd= Assy_Section_Cd,
@.Line_Cd = Line_Cd,
@.Production_Qty = Production_Qty,
@.Requirement_Qty= Requirement_Qty
FROM #WK_PDR_ProcessingData|||tilak.negi@.mind-infotech.com (tilak.negi@.mind-infotech.com) writes:
> While inserting records in hash table. It is already order by on some
> fields.

And once it is inserted, there is no longer any order.

> But when selecting/updating records, I want the same order of records
> should be updated/selected.
> "Rows in tables have NO logical order in a relational database"
> I think, True for hash(#) and permanent table.

Well, obviously you have some operation that does not give you the
desired result, and you posted an UPDATE statement, which is a little
funny, because all you do is to assign a variable.

I suggest that you follow the standard recommendation and post:

o CREATE TABLE statement for your table(s)
o INSERT statements with sample data.
o The desired result given the sample.
o A short narrative of what ou are trying to achieve.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||UPDATEs are not ordered either. The result of your UPDATE statement is
undefined, unreliable and, in my view, not useful.

Please specify the whole problem rather than post fragments of your
non-working solution. The best way to specify the problem is to post
DDL, sample data and required end results. See:
http://www.aspfaq.com/etiquette.asp?id=5006

--
David Portas
SQL Server MVP
--

Monday, February 27, 2012

Handling out-dated transaction records

For performance issue, I believe many program should have a house-keeping procedure to clean up transaction history. Is there any best practice to perform this? Or should it be done simply by moving transaction data from the transaction table into a history table? Any better or consideration that I should be concerned of?Depends on your environment. Many places would like to keep records for atleast 2 years, but if you are in the medical field and some of your stuff may fall under HIPAA, then you need to keep the records I believe for like 7+ years. In those cases, I usually have an audit table that contains all the transaction data (It's written to via a trigger). Then I keep the transaction table fairly clean (only recent/open/pending), and if you need historical data, then I run my queries off the audit table instead which is never purged and has a good set of indexes on it.

Sunday, February 19, 2012

Handle DTS Errors

Hi,
I'm using DTS for pulling data from Oracle into SQL Server.

I retrieve the records from Oracle and insert into a staging table and from there invoke an ExecuteTask in DTS to transfer the data to the SQL Server table deciding on whether to Insert / Update / Delete appropriately based on certain parameters.

During the Insert / Update / Delete there might be constraints on the original SQL Server table which might throw errors in case of data inconsistencies. I want to track the errors arising in this scenario and take a call on whether to ignore them or not.

When I schedule the DTS package from the designer the constraint violations are picked up by the DTS and it stops the package execution. Later I coded the same on VBScript and I've handled the error using the WithEvents along with the Package2 object and tried giving a Cancel = False in the OnError Event.

But this does not seem to be working. The package is still exiting abnormally. The piece of code which I've used to Cancel the DTS Error is given below.

Private Sub goPackage_OnError(ByVal EventSource As String, _
ByVal ErrorCode As Long, _
ByVal Source As String, _
ByVal Description As String, _
ByVal HelpFile As String, _
ByVal HelpContext As Long, _
ByVal IDofInterfaceWithError As String, _
ByRef pbCancel As Boolean)

Debug.Print "DTSPackage - Error"
pbCancel = False
End Sub

Private Sub goPackage_OnQueryCancel(ByVal EventSource As String, _
ByRef pbCancel As Boolean)

Debug.Print "DTSPackage - Query cancelled"
pbCancel = False
End Sub

Setting pbCancel = False should ideally inform the DTS package to continue with execution and ignore the Errors but then the package is still terminating abnormally when an error is encountered and the rest of the records do not get processed.

Any suggestions in this regard would be greatly appreciated.A couple of thoughts:

1. Your code includes the statements Debug.print. I don't think that Debug.print is supported in VBScript and it's not supported at runtime in VB.

2. Have you looked at DTSTransformStat_SkipRow? I'm having a hard time picturing where this code is in your DTS Package. However, if you use the ActiveX script to copy data over, you can specify that on an error the row should be skipped (and you can log that row if you wanted). For example:

Function Main

DTSDestination("Foo") = DTSSource("Foo")
DTSDestination("Bar") = DTSSource("Bar")

errCount = 0

' Do your exception handling here
If DTSSource("Foo") > 10 Then
errCount = errCount + 1
End if

If DTSSource("Bar") < 8 Then
errCount = errCount + 1
End if

If errCnt > 0 Then
Main = DTSTransformStat_SkipRow
Else
Main = DTSTransformStat_OK
End If
End function

Note that this is probably a very sloppy (not to mention slow) way of doing things. Nevertheless, it is a potential solution to your question.

Hopefully, it will give you some ideas that you can pursue.

Regards,

Hugh Scott

Originally posted by Mohana Krishnan
Hi,
I'm using DTS for pulling data from Oracle into SQL Server.

I retrieve the records from Oracle and insert into a staging table and from there invoke an ExecuteTask in DTS to transfer the data to the SQL Server table deciding on whether to Insert / Update / Delete appropriately based on certain parameters.

During the Insert / Update / Delete there might be constraints on the original SQL Server table which might throw errors in case of data inconsistencies. I want to track the errors arising in this scenario and take a call on whether to ignore them or not.

When I schedule the DTS package from the designer the constraint violations are picked up by the DTS and it stops the package execution. Later I coded the same on VBScript and I've handled the error using the WithEvents along with the Package2 object and tried giving a Cancel = False in the OnError Event.

But this does not seem to be working. The package is still exiting abnormally. The piece of code which I've used to Cancel the DTS Error is given below.

Private Sub goPackage_OnError(ByVal EventSource As String, _
ByVal ErrorCode As Long, _
ByVal Source As String, _
ByVal Description As String, _
ByVal HelpFile As String, _
ByVal HelpContext As Long, _
ByVal IDofInterfaceWithError As String, _
ByRef pbCancel As Boolean)

Debug.Print "DTSPackage - Error"
pbCancel = False
End Sub

Private Sub goPackage_OnQueryCancel(ByVal EventSource As String, _
ByRef pbCancel As Boolean)

Debug.Print "DTSPackage - Query cancelled"
pbCancel = False
End Sub

Setting pbCancel = False should ideally inform the DTS package to continue with execution and ignore the Errors but then the package is still terminating abnormally when an error is encountered and the rest of the records do not get processed.

Any suggestions in this regard would be greatly appreciated.|||Thanks buddy. This did give me a idea. I split my tables into Staging tables and Temporary tables. Finally added a task in between to make sure that all the erroneous records are filtered out and moved to the respective error tables. I wanted to check for foreign key violations mostly. Later I went ahead and inserted the rest of the records in the staging tables directly into the master tables. This worked out fine.

Thanks anyway.
Regards
Mohan