473,507 Members | 5,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dts works from SqlServer but not from ASP.net



I have an asp.net page that executes a DTS. When I execute that DTS from
enterprise manager it takes about 5000 rows from the as400 and insert
into sql server
It works right. but when I execute it from my asp.net page I have this
error.

Error al procesar DTS TransferirDatos(ExistMP) en el paso
DTSStep_DTSActiveScriptTask_1System.Exception
I have this on my ASP page

Private Sub btnenviar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnenviar.Click
Try
objexecsp.ejecuta_SP_EXISTENCIASMP()

lblmensajes.Text = "Proceso generado satisfactoriamente"
Catch ex As Exception
lblmensajes.Text = ex.Message + ex.GetBaseException.ToString
+ ex.Source.ToString
End Try
End Sub

this on my Data Classs

Public Function ejecuta_SP_EXISTENCIASMP()
' call UpdatePrice using a parameter array of SqlParameter
objects
Try
Dim ejecutardts As New cDTS
ejecutardts.EjecutarDTS("TransferirDatos(ExistMP)" )
Catch ex As Exception
Throw ex
End Try
End Function

This is what executes the DTS

Imports System.Runtime.InteropServices
Imports System.Configuration.ConfigurationSettings
Imports DTS

Public Class cDTS

Public Sub EjecutarDTS(ByVal NombreDTS As String)
Dim pkg As New DTS.Package
Dim oStep As DTS.Step
Try
pkg = New DTS.Package
'pkg.LoadFromSQLServer(AppSettings("MED20NT"),
AppSettings("user"), AppSettings("pwd"),
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "",
"pruebaCdr1")
pkg.LoadFromSQLServer("MED20NT", "sa", "prueva",
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "", NombreDTS,
"")

pkg.AutoCommitTransaction = True
pkg.Execute()

For Each oStep In pkg.Steps
If oStep.ExecutionResult =
DTSStepExecResult.DTSStepExecResult_Failure Then
Throw New Exception("Error al procesar DTS " &
pkg.Name & " en el paso " & oStep.Name)
End If
Next
Catch ex As System.Runtime.InteropServices.COMException
Throw ex
Catch ex As Exception
Throw ex
Finally
pkg.UnInitialize()
pkg = Nothing
End Try
End Sub
End Class

This is the CODE of my dts
but as I told before it Works when I right Click on it in enterprise
manager

Dim ConnSql
Dim ConnDb2

'* Función para Conexion a Base de Datos ASW en Med13nt
Function ConexionSql()
'On Error Resume Next
Dim strConexion
strConexion = "Provider=SQLOLEDB.1;" & _
"Persist Security Info=True;" & _
"User ID=sa;Password=xx;" & _
"Initial Catalog=asw;" & _
"Data Source=Med20nt"
Set ConnSql = CreateObject("ADODB.Connection")
ConnSql.Open strConexion
If Err.Number <> 0 then ConexionSql = False
End Function

'* Función de Conexion a ASW as400
Function ConexionDb2()
'On Error Resume Next
Dim strConexion
strConexion = "DSN=asw1;User ID=CLAUDIMON;Password=xx"
Set ConnDb2 = CreateObject("ADODB.Connection")
ConnDb2.Open strConexion
If Err.Number <> 0 Then ConexionDb2 = False
' conexion por OLEDB
' Dim strconexion
' strconexion = "Provider=IBMDA400.DataSource.1; Data
source=10.2.0.10;User Id=FVENTAS;Password=xx"
' Set ConnDb2 = CreateObject("ADODB.Connection")
' ConnDb2.Open strConexion
' If Err.Number <> 0 Then ConexionDb2 = False

End Function
'* Trasfiere los datos de ASW a Med20nt
Private Function Transferir()
'On Error Resume Next
Dim strSql
Dim producto
Dim strSql2
Dim strSql3
Dim strCero
Dim strcomilla
Dim RS
Dim RS2
Dim RS3
Dim Contador
Dim StrBodega
strBodega=" "
contador=1
strcomilla="'"
strCero="0"
Set RS = CreateObject("ADODB.Recordset")
Set RS2 = CreateObject("ADODB.Recordset")
Set RS3 = CreateObject("ADODB.Recordset")

strSql3 = "SELECT distinct producto from sumvenmpf"
ConnSql.Execute (strSql3)

RS.Open strSql3, ConnSql
' ConnSql.Execute (strSql3)

Do Until RS.EOF
Set RS2 = CreateObject("ADODB.Recordset")
strSql = "SELECT srprdc, srsrom,
srplan,ctname,sum(srsthq), sum(srpurq), sum(srcusq), sum(srpicq) FROM
HCB453AFIH.srbsro,HCB453AFIH.srbctlsd where ctsign=srplan and
srprdc="&strcomilla&RS.Fields("producto").value&st rcomilla &" and
(srsthq>0 or srpurq>0 or srcusq>0 or srpicq>0) group by
srprdc,srsrom,srplan,ctname"
contador=0
RS2.Open strSql, ConnDb2
contador=contador+1
Do until RS2.EOF
strSql2 = "INSERT INTO ASW.dbo.Existenciasmp
(srprdc,srsrom,srplan,ctname,srsthq, srpurq, srcusq, srpicq ) values
('" & RS2.Fields("srprdc").value & "','" & RS2.Fields("srsrom").value
& "','" & RS2.Fields("srplan").value & "','" &
RS2.Fields("ctname").value & "','" & RS2.Fields(4).value & "','" &
RS2.Fields(5).value & "','" & RS2.Fields(6).value & "','" &
RS2.Fields(7).value & "')"
ConnSql.Execute (strSql2)
RS2.MoveNext
Loop
RS2.Close
Set RS2 = Nothing
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
End Function

'* Inicio de la Interfaz
Function Principal()
'On Error Resume Next
Call ConexionSql
Call ConexionDb2
Call Transferir()
Principal = DTSTaskExecResult_Success
End Function

The strange thing here is that it always returns 864 rows.

when executing from asp.net and 5000 from enterprise manager

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
1 1208
Are you logged in when you are in the ASP.NET application or are you under
the user context IUSR_MachineName? In other words, does your web app force a
windows login? If not, you are anonymous and that is why.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"luis valencia" wrote:


I have an asp.net page that executes a DTS. When I execute that DTS from
enterprise manager it takes about 5000 rows from the as400 and insert
into sql server
It works right. but when I execute it from my asp.net page I have this
error.

Error al procesar DTS TransferirDatos(ExistMP) en el paso
DTSStep_DTSActiveScriptTask_1System.Exception
I have this on my ASP page

Private Sub btnenviar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnenviar.Click
Try
objexecsp.ejecuta_SP_EXISTENCIASMP()

lblmensajes.Text = "Proceso generado satisfactoriamente"
Catch ex As Exception
lblmensajes.Text = ex.Message + ex.GetBaseException.ToString
+ ex.Source.ToString
End Try
End Sub

this on my Data Classs

Public Function ejecuta_SP_EXISTENCIASMP()
' call UpdatePrice using a parameter array of SqlParameter
objects
Try
Dim ejecutardts As New cDTS
ejecutardts.EjecutarDTS("TransferirDatos(ExistMP)" )
Catch ex As Exception
Throw ex
End Try
End Function

This is what executes the DTS

Imports System.Runtime.InteropServices
Imports System.Configuration.ConfigurationSettings
Imports DTS

Public Class cDTS

Public Sub EjecutarDTS(ByVal NombreDTS As String)
Dim pkg As New DTS.Package
Dim oStep As DTS.Step
Try
pkg = New DTS.Package
'pkg.LoadFromSQLServer(AppSettings("MED20NT"),
AppSettings("user"), AppSettings("pwd"),
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "",
"pruebaCdr1")
pkg.LoadFromSQLServer("MED20NT", "sa", "prueva",
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "", NombreDTS,
"")

pkg.AutoCommitTransaction = True
pkg.Execute()

For Each oStep In pkg.Steps
If oStep.ExecutionResult =
DTSStepExecResult.DTSStepExecResult_Failure Then
Throw New Exception("Error al procesar DTS " &
pkg.Name & " en el paso " & oStep.Name)
End If
Next
Catch ex As System.Runtime.InteropServices.COMException
Throw ex
Catch ex As Exception
Throw ex
Finally
pkg.UnInitialize()
pkg = Nothing
End Try
End Sub
End Class

This is the CODE of my dts
but as I told before it Works when I right Click on it in enterprise
manager

Dim ConnSql
Dim ConnDb2

'* Funcisn para Conexion a Base de Datos ASW en Med13nt
Function ConexionSql()
'On Error Resume Next
Dim strConexion
strConexion = "Provider=SQLOLEDB.1;" & _
"Persist Security Info=True;" & _
"User ID=sa;Password=xx;" & _
"Initial Catalog=asw;" & _
"Data Source=Med20nt"
Set ConnSql = CreateObject("ADODB.Connection")
ConnSql.Open strConexion
If Err.Number <> 0 then ConexionSql = False
End Function

'* Funcisn de Conexion a ASW as400
Function ConexionDb2()
'On Error Resume Next
Dim strConexion
strConexion = "DSN=asw1;User ID=CLAUDIMON;Password=xx"
Set ConnDb2 = CreateObject("ADODB.Connection")
ConnDb2.Open strConexion
If Err.Number <> 0 Then ConexionDb2 = False
' conexion por OLEDB
' Dim strconexion
' strconexion = "Provider=IBMDA400.DataSource.1; Data
source=10.2.0.10;User Id=FVENTAS;Password=xx"
' Set ConnDb2 = CreateObject("ADODB.Connection")
' ConnDb2.Open strConexion
' If Err.Number <> 0 Then ConexionDb2 = False

End Function
'* Trasfiere los datos de ASW a Med20nt
Private Function Transferir()
'On Error Resume Next
Dim strSql
Dim producto
Dim strSql2
Dim strSql3
Dim strCero
Dim strcomilla
Dim RS
Dim RS2
Dim RS3
Dim Contador
Dim StrBodega
strBodega=" "
contador=1
strcomilla="'"
strCero="0"
Set RS = CreateObject("ADODB.Recordset")
Set RS2 = CreateObject("ADODB.Recordset")
Set RS3 = CreateObject("ADODB.Recordset")

strSql3 = "SELECT distinct producto from sumvenmpf"
ConnSql.Execute (strSql3)

RS.Open strSql3, ConnSql
' ConnSql.Execute (strSql3)

Do Until RS.EOF
Set RS2 = CreateObject("ADODB.Recordset")
strSql = "SELECT srprdc, srsrom,
srplan,ctname,sum(srsthq), sum(srpurq), sum(srcusq), sum(srpicq) FROM
HCB453AFIH.srbsro,HCB453AFIH.srbctlsd where ctsign=srplan and
srprdc="&strcomilla&RS.Fields("producto").value&st rcomilla &" and
(srsthq>0 or srpurq>0 or srcusq>0 or srpicq>0) group by
srprdc,srsrom,srplan,ctname"
contador=0
RS2.Open strSql, ConnDb2
contador=contador+1
Do until RS2.EOF
strSql2 = "INSERT INTO ASW.dbo.Existenciasmp
(srprdc,srsrom,srplan,ctname,srsthq, srpurq, srcusq, srpicq ) values
('" & RS2.Fields("srprdc").value & "','" & RS2.Fields("srsrom").value
& "','" & RS2.Fields("srplan").value & "','" &
RS2.Fields("ctname").value & "','" & RS2.Fields(4).value & "','" &
RS2.Fields(5).value & "','" & RS2.Fields(6).value & "','" &
RS2.Fields(7).value & "')"
ConnSql.Execute (strSql2)
RS2.MoveNext
Loop
RS2.Close
Set RS2 = Nothing
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
End Function

'* Inicio de la Interfaz
Function Principal()
'On Error Resume Next
Call ConexionSql
Call ConexionDb2
Call Transferir()
Principal = DTSTaskExecResult_Success
End Function

The strange thing here is that it always returns 864 rows.

when executing from asp.net and 5000 from enterprise manager

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2961
by: Martijn Rutte | last post by:
Hi, On one side, I have a Sybase 12.5 32 bits Server running on AIX 5.1 (maintenance level 3). On the other, I've got W2000 5.00.2195 (SP2) with SQL Server Standard Edition, Product Version...
7
2346
by: Bart Torbert | last post by:
Hello, I am starting to examine using SQLServer instead of Oracle. I went through the SQLServer import utility to copy tables from Oracle into SQLServer. I then checked the size of the...
1
1528
by: Matik | last post by:
Hello to all, Maybe first small introduction: - SQLServer 2000 SP3, - XP Pro EN, - ActiveX, - SP in database It should working like this. There is a instanse of an object working, which...
1
1992
by: Steve | last post by:
I'm trying to get some data out of SQLServer on our Webserver. I built the database on my local machine and the code pages are on my C: drive and the virtual folders are in IIS running on my...
0
1148
by: how can i insert a image to SQLServer? | last post by:
I want to insert some strings and images which from richTextBox into SQLServer. I could insert it into SQLServer,such as follows: FileStream s=new FileStream...
14
2109
by: Roy Gourgi | last post by:
Hi, I need to store and retrieve information from a database. It looks as though there is a lot more support for SQLServer than there is for Access, correct me if I am wrong. What do I have...
0
1550
by: UDBDBA | last post by:
Hi: We have a setup which connects a V8.2 32bit db2 instance on AIX to SQLServer 2000 using the unixODBC driver. We have 5 SQLServer "Server mappings" and 4 of them work just fine and can use...
1
1505
by: Jamie Schatte | last post by:
We have two ASP.NET 2.0 websites, both running on the same production web server. One website uses SQLServer mode for session state with no problems. However, although the other website works great...
2
2897
by: Jenniflower | last post by:
Hi Gurus, Our system is using SqlServer 2005 on XP.( On my machine,only this application access SQLServer.) The sqlserver memory is configured to 128MB (Min)~512 MB(Max) After our system get...
7
1604
by: Academia | last post by:
I was told that SqlServer express should get installed when VS2008Pro is installed (that is it is on the same DVD). I had a couple of errors during vs2008's installation and I don't see any...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.