Need To Call Com Object Using Sp_OACreate

Apr 11, 2008

Hi,
I have com object on another machine, and I want to call from diffetent machine,Is It possible to use sp_oACreate to creating object of com object that resides on another computer.

Thanks


View 1 Replies


ADVERTISEMENT

EXECUTE Permission Denied On Object 'sp_OACreate', Database 'mssqlsystemresource'

Oct 5, 2006

HI There

I have a user login that is executing an sp. It gets the follwoing error:
Msg 229, Level 14, State 5, Procedure sp_OACreate, Line 1
EXECUTE permission denied on object 'sp_OACreate', database 'mssqlsystemresource', schema 'sys'.
Msg 229, Level 14, State 5, Procedure sp_OAMethod, Line 1
EXECUTE permission denied on object 'sp_OAMethod', database 'mssqlsystemresource', schema 'sys'.
Msg 229, Level 14, State 5, Procedure sp_OAMethod, Line 1
EXECUTE permission denied on object 'sp_OAMethod', database 'mssqlsystemresource', schema 'sys'.
Msg 229, Level 14, State 5, Procedure sp_OAMethod, Line 1
EXECUTE permission denied on object 'sp_OAMethod', database 'mssqlsystemresource', schema 'sys'.
Msg 229, Level 14, State 5, Procedure sp_OAGetProperty, Line 1
EXECUTE permission denied on object 'sp_OAGetProperty', database 'mssqlsystemresource', schema 'sys'.
Msg 229, Level 14, State 5, Procedure sp_OAGetProperty, Line 1
EXECUTE permission denied on object 'sp_OAGetProperty', database 'mssqlsystemresource', schema 'sys'.
Msg 229, Level 14, State 5, Procedure sp_OADestroy, Line 1
EXECUTE permission denied on object 'sp_OADestroy', database 'mssqlsystemresource', schema 'sys'.

Everything ic an find on the net refers to Sql Server 2000 but this is 2005, all the resolutions say you must grant exec permissions to the user account for these sp's in the master database.

BUT is SS2005 they are in the mysqlsystemresource database.

WHen i try the following

grant exec on mssqlsystemresource.sys.sp_OACreate to UserLogin:

I get this error:

Cannot find the object sp_OACreate, becuase the object does not exist or you do not have permission.

I am logged in as sysadmin so i doubt it is permission.

How do i get a user login to be able to exec these sp's?

Thanx

View 11 Replies View Related

EXECUTE Permission Denied On Object 'sp_OACreate', Database 'master', Owner 'dbo'.

Sep 21, 2005

I want to send email using sql stored procedure.my code is work fine in my local sqlserver account. when I use my online sql server it display this error.
EXECUTE permission denied on object 'sp_OACreate', database 'master', owner 'dbo'.
EXECUTE permission denied on object 'sp_OASetProperty', database 'master', owner 'dbo'.
EXECUTE permission denied on object 'sp_OAMethod', database 'master', owner 'dbo'.
EXECUTE permission denied on object 'sp_OADestroy', database 'master', owner 'dbo'.
How canI solove this problem?

View 1 Replies View Related

EXECUTE Permission Denied On Object Sp_OACreate/method/GetProperty/Destroy

Aug 3, 2002

Hi friends

I copy script that use SQL proc to call DTS package from this site.

When I run this procedure in SQL query alalyzer. I got an error messages:
EXECUTE permission denied on object sp_OACreate/method/GetProperty/Destroy.
I did not change anything in spExecutePKG.
Even I used sa as ServerPWD. How to fix this problem? my code is
exec spExecutePKG 'myserver','execl_DTS','sa','0',''
Thanks
jimmy

------proc original code
CREATE PROC spExecutePKG
@Server varchar(255),
@PkgName varchar(255), -- Package Name (Defaults to most recent version)
@ServerPWD varchar(255) = Null,-- Server Password if using SQL Security to load Package (UID is SUSER_NAME())
@IntSecurity bit = 0,-- 0 = SQL Server Security, 1 = Integrated Security
@PkgPWD varchar(255) = ''-- Package Password
AS
SET NOCOUNT ON
/*
Return Values
- 0 Successfull execution of Package
- 1 OLE Error
- 9 Failure of Package
*/
DECLARE @hr int, @ret int, @oPKG int, @Cmd varchar(1000)

-- Create a Pkg Object
EXEC @hr = sp_OACreate 'DTS.Package', @oPKG OUTPUT
IF @hr <> 0
BEGIN
PRINT '*** Create Package object failed'
EXEC sp_displayoaerrorinfo @oPKG, @hr
RETURN 1
END

-- Evaluate Security and Build LoadFromSQLServer Statement
IF @IntSecurity = 0
SET @Cmd = 'LoadFromSQLServer("' + @Server +'", "' + SUSER_SNAME() + '", "' + @ServerPWD + '", 0, "' + @PkgPWD + '", , , "' + @PkgName + '")'
ELSE
SET @Cmd = 'LoadFromSQLServer("' + @Server +'", "", "", 256, "' + @PkgPWD + '", , , "' + @PkgName + '")'

EXEC @hr = sp_OAMethod @oPKG, @Cmd, NULL

IF @hr <> 0
BEGIN
PRINT '*** LoadFromSQLServer failed'
EXEC sp_displayoaerrorinfo @oPKG , @hr
RETURN 1
END

-- Execute Pkg
EXEC @hr = sp_OAMethod @oPKG, 'Execute'
IF @hr <> 0
BEGIN
PRINT '*** Execute failed'
EXEC sp_displayoaerrorinfo @oPKG , @hr
RETURN 1
END

-- Check Pkg Errors
EXEC @ret=spDisplayPkgErrors @oPKG

-- Unitialize the Pkg
EXEC @hr = sp_OAMethod @oPKG, 'UnInitialize'
IF @hr <> 0
BEGIN
PRINT '*** UnInitialize failed'
EXEC sp_displayoaerrorinfo @oPKG , @hr
RETURN 1
END

-- Clean Up
EXEC @hr = sp_OADestroy @oPKG
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @oPKG , @hr
RETURN 1
END

RETURN @ret
GO

View 1 Replies View Related

EXECUTE Permission Denied On Object 'sp_OACreate', Database 'master', Owner 'dbo'.

Sep 21, 2005

I want to send email using sql stored procedure.my code is work fine in my local sqlserver account. when I use my online sql server it display this error.

EXECUTE permission denied on object 'sp_OACreate', database 'master', owner 'dbo'.

EXECUTE permission denied on object 'sp_OASetProperty', database 'master', owner 'dbo'.

EXECUTE permission denied on object 'sp_OAMethod', database 'master', owner 'dbo'.

EXECUTE permission denied on object 'sp_OADestroy', database 'master', owner 'dbo'.

How canI solove this problem?

View 2 Replies View Related

How To Call An Object

Feb 27, 2008



Hello,

Does anybody know if it's possible to call an object (specifically, a textbox) from the expression of another object? I would imagine it would something like 'objectname.Value' or 'objectname.ToString', but I can't get it to recognise my object names.

I have two textboxes - Last Event and Number of Weeks Since Last Event. I have an expression to calculate the date of the last event (which is rather lengthy), and currently I get the number of weeks by doing a DateDiff between Today and another copy of the lengthy LastEvent code. This works, but it would be much simpler and more efficient if I could just say:

DateDiff("W", LastEvent.ToString, Today)


Anybody have any ideas?


Cheers,
Peter

View 3 Replies View Related

How To Call Remote Object Using C# Stored Procedure

Nov 29, 2005

I want to call a windows based service running with remote objects listner from a C# Stored procedure. Any idea how to do that?

View 2 Replies View Related

Error Message When You Call The Pull Method Of An RDA Object

Apr 25, 2007

Has there been any fix for this bug? The workaround in the KB article did not work for me and I cannot run my entire application from the Windows directory even if it did.

Please help.

Original Thread:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PageIndex=1&SiteID=1&PostID=274359

Workaround KB article: (I cannot run my app from Window directory)
http://support.microsoft.com/kb/920272

View 3 Replies View Related

Error Message When I Call The Pull Method Of An RDA Object

Mar 27, 2008

Hi, I've got the error message below:
"Error 80040E2F. A duplicate value cannot be inserted into a unique index [Table name=_SysRDASubscriptions, Constraint name=c_LocalTableName]"

I'm using SQL Server 2005 Compact Edition and still cannot solve the problem although the KB article (920272) said it is fixed in V3.1.

What I need to do is to drop a table and then Pull it again to the PDA but it gives me that error message during pull method. However, I can use the same process to drop and pull other tables and works fine. Will that be the problem related to primary key or to the data of the table?

Please help!! Thx.

View 3 Replies View Related

How Do I Call A Insert Stored Procedure From A Data Flow Destination Object?

Jun 26, 2007

I want to insert data calling a stored procedure and call this from a Data Flow destination object. Is it possible?



I understand that Ole Db Command transformation object can call stored procedure, but that will not rollback in the event of error in the middle.



I understand that Ole Db Destination object will rollback in middle of import, but I don't see how to do the insert by calling stored procedure. "Sql Command" option in Ole Db Destination object does not seem to present solution to the problem.



Am I missing something here or is Ssis / Microsoft demanding that Insert stored procedure not be used when using Data Flow destination object to insert data into target table?

View 8 Replies View Related

SP_oacreate

Mar 31, 2008

pls send me some code samples to import a html/txt file using the sp_oacreate procedure
am getting the error number -2147221005


please let me know

View 5 Replies View Related

Sp_OACreate With Excel

Jan 3, 2002

I'm having problems creating and saving an Excel object.

I can create a Word document, but not an Excel file

It fails and Excel is in the task manager but nothing else happens.

I have to kill the processes, from my Exe/Dll viewer "ProcExp"
(It's a cool app, that saves me from rebooting to free up my system)

Anyway, here is both my VBS and TSQL code.

TIA

JeffP...

/*
'vbs code......saved in Notepad
Dim myexcel
set myexcel = createobject("Excel.Application")
myExcel.Application.UserName = "JeffP"
myExcel.Application.Workbooks.Add
myExcel.Application.ActiveWorkbook.SaveAs ("Me.xls")
myExcel.Application.ActiveWorkbook.Save
myExcel.Workbooks.Close
myExcel.Application.Quit
'end vbs code
*/
--begin tsql
declare @Obj int ,@file varchar(100) ,@user varchar(100) ,@res int
,@sheet int ,@saveas varchar(255) ,@save varchar(255)

set @user = 'Jackx'
set @file = 'me.xls'

set @saveas = 'ActiveWorkbook.SaveAs("C:Documents and SettingsjeffMy Documents")'
set @save = 'ActiveWorkbook.Save'

exec @res = sp_oacreate 'excel.application' ,@obj output
print 'Obj'
print @res
print @obj
print '-------'

exec @res = sp_oamethod @obj ,'workbooks.add' ,@sheet output
print 'add'
print @res
print @sheet
print '-------'

exec @res = sp_oamethod @obj ,@saveas
print 'saveas'
print @res
print @file
print '-------'

exec @res = sp_oamethod @obj ,'ActiveWorkbook.Save'
print 'save'
print @res
print @file
print '-------'

exec @res = sp_oamethod @obj ,'Workbooks.Close'
print 'close'
print @res
print @file
print '-------'

exec @res = sp_oamethod @obj ,'quit'
print 'quit'
print @res
print @sheet
print '-------'

exec @res = sp_oadestroy @obj
print 'end'
print @res
--end tsql

View 1 Replies View Related

Sql Server : Sys.sp_OACreate Error

May 21, 2008

I tried to  send the html format email alert  through sql server. Its working fine in sql server 2000 (Dev Server). then i
moved to production server (sql server 2005).
when i run this email program (USP_SendHolidayAlert) in sql server 2005, i got the folloing errors,
Msg 15281, Level 16, State 1, Procedure sp_OACreate, Line 1SQL Server blocked access to procedure 'sys.sp_OACreate' of component 'Ole Automation Procedures' because this component is
turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ole
Automation Procedures' by using sp_configure. For more information about enabling 'Ole Automation Procedures', see "Surface
Area Configuration" in SQL Server Books Online.
Msg 15281, Level 16, State 1, Procedure sp_OASetProperty, Line 1SQL Server blocked access to procedure 'sys.sp_OASetProperty' of component 'Ole Automation Procedures' because this component
is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ole
Automation Procedures' by using sp_configure. For more information about enabling 'Ole Automation Procedures', see "Surface
Area Configuration" in SQL Server Books Online.
Msg 15281, Level 16, State 1, Procedure sp_OASetProperty, Line 1SQL Server blocked access to procedure 'sys.sp_OASetProperty' of component 'Ole Automation Procedures' because this component
is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ole
Automation Procedures' by using sp_configure. For more information about enabling 'Ole Automation Procedures', see "Surface
Area Configuration" in SQL Server Books Online.
Msg 15281, Level 16, State 1, Procedure sp_OAMethod, Line 1SQL Server blocked access to procedure 'sys.sp_OAMethod' of component 'Ole Automation Procedures' because this component is
turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ole
Automation Procedures' by using sp_configure. For more information about enabling 'Ole Automation Procedures', see "Surface
Area Configuration" in SQL Server Books Online.
Msg 15281, Level 16, State 1, Procedure sp_OADestroy, Line 1SQL Server blocked access to procedure 'sys.sp_OADestroy' of component 'Ole Automation Procedures' because this component is
turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ole
Automation Procedures' by using sp_configure. For more information about enabling 'Ole Automation Procedures', see "Surface
Area Configuration" in SQL Server Books Online.
Stored Procedure----------------
CREATE Procedure USP_SendHolidayAlert           /*                        Name:  USP_SendHolidayAlert                     Description:  Send Email holiday Alert  Author:  Gopalan Mani                    Modification Log: Create                                            Description                  Date         Changed By                        Created procedure            13-05-2008    Gopalan Mani                    */                 @SenderName varchar(250),      @SenderAddress  varchar(250),      @RecipientName  varchar(250),      @RecipientAddress  varchar(250),      @Subject   varchar(250) ,     @Title  varchar(350)  ,    @HolidayDate   varchar(350)         as                  DECLARE @HtmlContent varchar(8000)                DECLARE @object int        DECLARE @executable int              DECLARE @RecCount int                        EXEC @executable = sp_OACreate 'CDONTS.NewMail', @object OUT        EXEC @executable = sp_OASetProperty @object, 'BodyFormat', 0        EXEC @executable = sp_OASetProperty @object, 'MailFormat', 0                       select @HtmlContent =MailText from Tbl_EmailContent where RecID=2         select @HtmlContent= REPLACE(@HtmlContent,'Holiday_Title',@Title)  select @HtmlContent= REPLACE(@HtmlContent,'Holiday_Date',@HolidayDate)      EXEC sp_OAMethod @object, 'Send', NULL,@SenderAddress ,@RecipientAddress,@Subject,@HtmlContent        EXEC sp_OADestroy @object        
please do some necessery steps to solve this problems.
 

View 2 Replies View Related

Sp_OACreate And Sp_OAMethed Heelllllpppp...

Mar 23, 2008

I have a question and I hoping to not sound to lame. I am trying to use the sp_oacreate and the sp_oamethed to run my dll from sql sever 2005
It looks some thing like this

EXEC @hr = sp_OACreate 'MyApplication.Adcom', @object OUT,5
IF @hr <> 0
BEGIN --Not able to create the object
Return @hr
END --Not able to create the object

EXEC @hr = sp_OAMethod @object, 'Authenticate', @FunctionReturn OUT, strUser, strPassword, strDoman
IF @hr <> 0
BEGIN --Not able to execute Com function
Return @hr
END --Not able to execute Com function

I have created my dll in .net and placed it in the root drive of the server. How does OACreate know where to locate my dll?
One executing this fucntion I am returning -2147221005
-214721148 error code.

Have I created my dll incorrectly? The name of the dll is ActiveDirectoryCom and the Class with in the dll is called Adcom and the function that need to run is called AuthenticateUserFullPath. Have I correctly Written the sp_Oa's

View 3 Replies View Related

Sp_OACreate And Sp_OAMethed Heelllllpppp...

Mar 23, 2008

I have a question and I hoping to not sound to lame. I am trying to use the sp_oacreate and the sp_oamethed to run my dll from sql sever 2005
It looks some thing like this

EXEC @hr = sp_OACreate 'MyApplication.Adcom', @object OUT,5
IF @hr <> 0
BEGIN --Not able to create the object
Return @hr
END --Not able to create the object

EXEC @hr = sp_OAMethod @object, 'Authenticate', @FunctionReturn OUT, strUser, strPassword, strDoman
IF @hr <> 0
BEGIN --Not able to execute Com function
Return @hr
END --Not able to execute Com function

I have created my dll in .net and placed it in the root drive of the server. How does OACreate know where to locate my dll?
One executing this fucntion I am returning -2147221005
-214721148 error code.

Have I created my dll incorrectly? The name of the dll is ActiveDirectoryCom and the Class with in the dll is called Adcom and the function that need to run is called AuthenticateUserFullPath. Have I correctly Written the sp_Oa's

View 4 Replies View Related

.Net COM Interop Class Not Working Via Sp_OACreate

Aug 2, 2006

this thread is actually to help another guy out in a seperate thread lol...I am not a COM expert but I do have a basic understanding of it from a dev perspective. I am trying to get COM interop via VS2005 to work from a sql2005 sp_OACreate call. below is the code. I can replace my custom object with say a sqldmo reference and IT WORKS! So I was thinking maybe security issues, but even when I run sql under an admin account it does not work. and i am connecting via sa for the code.

 

Also, I have tested the COM object via windows script host/.vbs file: dim oOjbect set oObject = CreateObject(myCOMObject.Math) msgbox oObject.Add(1,1). And the object appears to be listed correctly in the registry under HKEY_Classes

Imports System

Imports System.IO

Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Imports Microsoft.SqlServer.Server

Imports Microsoft.VisualBasic

Imports System.Diagnostics

 

Public Class Math

Public Function Add(ByVal iFirstNum As Integer, ByVal iSecondNum As Integer)

Return (iFirstNum + iSecondNum)

End Function

End Class

------------------------------------------------------------------------------------------

DECLARE @object int

DECLARE @hr int

DECLARE @src varchar(255), @desc varchar(255)

EXEC @hr = sp_OACreate 'myCOMObject.Math', @object OUT,5

IF @hr <> 0

BEGIN

EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT

SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc

RETURN

END

View 6 Replies View Related

Sp_OAcreate, Access.Application Can Not OpenCurrentDatabase

Jan 19, 2007

Hi all,

trying to use MS Access Automation from within SQL Server 2000 .

Seems that OpenCurrentDatabase (Access Application property) just hangs...

Following, the code that is used:

--BOF--

--object vars
DECLARE @w_object INT,
@s_object INT

--error handling vars
DECLARE @error INT
DECLARE @src VARCHAR(255),
@desc VARCHAR(255)

--execution vars
DECLARE @command NVARCHAR(100),
@property NVARCHAR(20)

--create an Access application
EXEC @error = sp_OACreate 'Access.Application', @w_object OUT
IF @error <> 0
BEGIN
EXEC sp_OAGetErrorInfo @w_object, @src OUT, @desc OUT
SELECT CONVERT(VARBINARY(4),@error) AS Error, @src AS Source, @desc AS [Description]
RETURN
END

--get default security level
EXEC sp_OAGetProperty @w_object, 'AutomationSecurity', @property OUT
SELECT @property AS default_security_level

--set application security level to low (no sandbox)
--thought this would help, but no luck
EXEC @error = sp_OASetProperty @w_object, 'AutomationSecurity', '1' --Low Security
IF @error <> 0
BEGIN
EXEC sp_OAGetErrorInfo @w_object
GOTO Cleanup
END

--Test security level
EXEC sp_OAGetProperty @w_object, 'AutomationSecurity', @property OUT
SELECT @property AS my_security_level

--check current user
EXEC sp_OAGetProperty @w_object, 'CurrentUser', @property OUT --should be Admin
SELECT @property AS current_application_user --it is Admin

--Open non password protected database,
SET @command = 'OpenCurrentDatabase("C:mikros.mdb")'

--unfortunately this hangs...
EXEC @error = sp_OAMethod @w_object, @command
IF @error <> 0
BEGIN
EXEC sp_OAGetErrorInfo @w_object, @src OUT, @desc OUT
SELECT 'Failed to Open database', CONVERT(VARBINARY(4),@error) AS Error, @src AS Source, @desc AS [Description]
GOTO Cleanup
END

--Close current database
EXEC @error = sp_OAMethod @w_object, 'CloseCurrentDatabase'
IF @error <> 0
BEGIN
EXEC sp_OAGetErrorInfo @w_object, @src OUT, @desc OUT
SELECT 'Failed to Close database', CONVERT(VARBINARY(4),@error) AS Error, @src AS Source, @desc AS [Description]
END

Cleanup:
--close Application
EXEC @error = sp_OAMethod @w_object, 'Quit'
IF @error <> 0
BEGIN
EXEC sp_OAGetErrorInfo @w_object
END

--destroy Application Object
EXEC @error = sp_OADestroy @w_object
IF @error <> 0
BEGIN
EXEC sp_OAGetErrorInfo @w_object
END

--EOF--



Any help would be appreciated.

Thanks in advance

View 1 Replies View Related

Sp_OACreate In SQL Server 2005, Fails With 'Not Enough Storage Is Available To Complete This Operation'

Jan 20, 2007

Hi all,

I have created a small COM in C# so that I can programatically create and execute stored procedures with SMO. At this point the COM has nothing in it but just a test prototype.
But when I tried to create the object as follows, I get the error indicated below.
It is not a memory issue because I have adequate storage and RAM.

Please Help!

DECLARE @object int
DECLARE @hr int
DECLARE @property varchar(255)
DECLARE @return varchar(255)
DECLARE @src varchar(255), @desc varchar(255)

-- Create an object.
EXEC @hr = sp_OACreate 'SQLInterop.CsharpHelper', @object OUT
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
END

This is the error I am getting:

Error Code: 0x8007000E
Description: Not enough storage is available to complete this operation.
Source: ODSOLE Extended Procedure


This is the C# code for the COM:

using System;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.EnterpriseServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CSServer")]
[assembly: AssemblyDescription("Test SQL .NET interop")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("MyKey.snk")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff35c6b4-81bf-47dd-9290-fcbbb49008d9")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]

// the ApplicationName attribute specifies the name of the
// COM+ Application which will hold assembly components
[assembly: ApplicationName("SQLInterop")]

// the ApplicationActivation.ActivationOption attribute specifies
// where assembly components are loaded on activation
// Library : components run in the creator's process
// Server : components run in a system process, dllhost.exe
[assembly: ApplicationActivation(ActivationOption.Server)]
namespace SQLInterop
{
public interface ITest
{
string SayHello();
string SayIt(String strMessage);
}

//[SecurityRole("RBSecurityDemoRole", SetEveryoneAccess = true)]
[ComVisible(true)]
[CLSCompliant(false)]
[ClassInterface(ClassInterfaceType.None)]
public class CSharpHelper : ITest
{
public string SayHello()
{
return "Hello from CSharp";
}

public string SayIt(String strMessage)
{
return strMessage + ": from CSharp";
}
}
}

View 8 Replies View Related

I Just Want One Entry For Each Call, With SLA Status 'Breach' If Any Of The Stages For The Call Were Out Of SLA.

Mar 19, 2008

Hi,

I am producing a php report using SQL queries to show the SLA status of our calls. Each call has response, fix & completion targets. If any of these targets are breached, the whole SLA status is set as 'Breach'.

The results table should look like the one below:





CallRef.

Description

Severity



ProblemRef

Logged
Date

Call
Status

SLA Status



C0001

Approval for PO€™s not received

2



DGE0014

05-01-06 14:48

Resolved

Breach


C0002

PO€™s not published

2



DGE0014

06-01-06 10:21

Resolved

OK


C0003

Approval for PO€™s not received from Siebel.

2



n/a

05-01-06 14:48

Investigating

OK



















Whereas I can pick the results for the first 6 columns from my Select query, the 'SLA Status' column requires the following calculation:

if (due_date < completed_date)
{ sla_status = 'OK';
}
else sla_status = 'Breach';

The Select statement in my query is looking like this...

Select Distinct CallRef, Description, Severity, ProblemRef, Logdate, Status, Due_date, Completed_date;

The problem is that my query is returning multiple entries for each stage of the call (see below), whereas I just want one entry for each call, with SLA status 'Breach' if any of the stages for the call were out of SLA.






CallRef.

Description

Severity



ProblemRef

Logged
Date

Call
Status

SLA Status



C0001

Approval for PO€™s not received

2



DGE0014

05-01-06 14:48

Resolved

Breach


C0001

Approval for PO€™s not received

2



DGE0014

05-01-06 14:48

Resolved

OK


C0001

Approval for PO€™s not received

2



DGE0014

05-01-06 14:48

Resolved

Breach



















Any help will be much much appreciated, this issue has been bothering me for some time now!!!




View 7 Replies View Related

Object Reference Not Set To An Instance Of An Object When Retrieving Data/Schema In Design Time

Oct 11, 2006

Hi There,This is related to a ms access database but since I use the SqlDataSource control I thought I should post here.I have a project that I was working on with this ms access db and using sql controls, everything was working just finesince one day I started getting "Object reference not set to an instance of an object" messages when I try to designa query or retrieve a schema,  nothing works at design time anymore but at runtime everything is perfect, its a lotof work for me now to create columns,schemas and everything manually, I've tried reinstalling visualstudio, ado componentsbut nothing seems to fix it, did this ever happen to any of you guys?any tip is really appreciated  thanks a lot 

View 2 Replies View Related

Server Error: Object Reference Not Set To An Instance Of An Object. Trying To Upload Image In Database

Dec 17, 2007

Does any one has any clue for this error ? I did went through a lot of articles on this error but none helped . I am working in Visual studie 2005 and trying to upload image in sql database through a simple form. Here is the code
 
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.IO;
public partial class Binary_frmUpload : System.Web.UI.Page
{protected void Page_Load(object sender, EventArgs e)
{
}protected void btnUpload_Click(object sender, EventArgs e)
{if (FileUpload.HasFile == false)
{
// No file uploaded!lblUploadDetails.Text = "Please first select a file to upload...";
}
else
{string str1 = FileUpload.PostedFile.FileName;
 string str2 = FileUpload.PostedFile.ContentType; string connectionString = WebConfigurationManager.ConnectionStrings["GSGA"].ConnectionString;
//Initialize SQL Server Connection SqlConnection con = new SqlConnection(connectionString);
//Set insert query string qry = "insert into Officers (Picture,PictureType ,PicttureTitle) values(@ImageData, @PictureType, @PictureTitle)";
//Initialize SqlCommand object for insert. SqlCommand cmd = new SqlCommand(qry, con);
//We are passing Original Image Path and Image byte data as sql parameters. cmd.Parameters.Add(new SqlParameter("@PictureTitle", str1));
cmd.Parameters.Add(new SqlParameter("@PictureType", str2));Stream imgStream = FileUpload.PostedFile.InputStream;
int imgLen = FileUpload.PostedFile.ContentLength;byte[] ImageBytes = new byte[imgLen]; cmd.Parameters.Add(new SqlParameter("@ImageData", ImageBytes));
//Open connection and execute insert query.
con.Open();
cmd.ExecuteNonQuery();
con.Close(); //Close form and return to list or images.
 
}
}
}
 
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:



Line 32:
Line 33: string str2 = FileUpload.PostedFile.ContentType;
Line 34: string connectionString = WebConfigurationManager.ConnectionStrings["GSGA"].ConnectionString;
Line 35:
Line 36: //Initialize SQL Server Connection Source File: c:UsersManojDocumentsVisual Studio 2005WebSitesGSGABinaryfrmUpload.aspx.cs    Line: 34  
Stack Trace:




[NullReferenceException: Object reference not set to an instance of an object.]
Binary_frmUpload.btnUpload_Click(Object sender, EventArgs e) in c:UsersManojDocumentsVisual Studio 2005WebSitesGSGABinaryfrmUpload.aspx.cs:34
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

View 2 Replies View Related

' The Definition Of Object [object Name] Has Changed Since It Was Compiled' Error When Altering A Trigger In 2005

Aug 17, 2007

Hello All

Not sure if this is the right forum to post this question to, so if it's not, please accept my apologies.

I'm working in SQL Server 2005 with a database that was migrated to 2005 from SQL Server 2000. I have to alter a trigger on a table for some functionality changes, and when I modify the trigger and then access it through the application the database is working with, I receive this error:


There was a error in the [stored procedure name] procedure. Error Number: -2147217900 Error Description: [Microsoft][ODBC SQL Server Driver][SQL Server]The definition of object '[trigger name]' has changed since it was compiled.


[stored procedure name] and [trigger name] are where the actual names appear in the message.

I've tried running sp_recompile on the trigger, stored procedure, and table that are associated with this, and nothing works. I have dropped the trigger, which allows the save process to complete (but doesn't perform the required functionality, of course), and then re-created the trigger, but the error message still comes up. The compatibility level for the database is SQL Server 2000 (80) (as it was migrated from SQL Server 2000 as I mentioned above).

Has anyone seen this, and if so, how can I fix it?

Thanks in advance for your help!

Jay

View 4 Replies View Related

When Using A Sqldataadapter In VS 2005 I Get The Following Error At Runtime. Object Reference Not Set To An Instance Of An Object

Dec 21, 2006

Help! I have posted this before and I had hoped that the VS2005 SP1 would help my problem. It didn't. My code is shown below. I have dropped a sqlconnection, sqldataadapter and a strongly-typed dataset from the toolbox onto the component designer for my page and written my code. It compiles without any errors but at runtine I receive the system error "Object reference not set to an instance of an object." The error occurs at the first line where the sqldataadapter is mentioned. I have shufflled the code and the error still occurs at first mention of the dataadapter. I have set parameters to a simple string such as "myemail." It hasn't helped. I have used the "Dim" statement as "Dim DaAuthorLogin as System.Data.SqlClient.SqlDataadapter and Dim DaAuthorLogin as New ......) at the start of the private sub generated by the event requiring the data. Nothing helps. Here is my simple code to select data from a sqlserver 2000 database. Why do I continue to get this error?
Partial Class AuthorLogin
Inherits System.Web.UI.Page
Protected WithEvents AuthorInformation As System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.DaAuthorLogin = New System.Data.SqlClient.SqlDataAdapter
Me.MDData = New System.Data.SqlClient.SqlConnection
Me.DsAuthorLogin = New MedicalDecisions.DsAuthorLogin
CType(Me.DsAuthorLogin, System.ComponentModel.ISupportInitialize).BeginInit()
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT AuthorAlias, AuthorEmail, AuthorPassword, LastName, PreferredName" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "FRO" & _
"M T_Author" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "WHERE (AuthorEmail = @AuthorEmail) AND (AuthorPassword =" & _
" @AuthorPassword)"
Me.SqlSelectCommand1.Connection = Me.MDData
Me.SqlSelectCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@AuthorEmail", System.Data.SqlDbType.NVarChar, 50, "AuthorEmail"), New System.Data.SqlClient.SqlParameter("@AuthorPassword", System.Data.SqlDbType.NVarChar, 50, "AuthorPassword")})
'
'DaAuthorLogin
'
Me.DaAuthorLogin.SelectCommand = Me.SqlSelectCommand1
Me.DaAuthorLogin.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "T_Author", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("AuthorAlias", "AuthorAlias"), New System.Data.Common.DataColumnMapping("AuthorEmail", "AuthorEmail"), New System.Data.Common.DataColumnMapping("AuthorPassword", "AuthorPassword"), New System.Data.Common.DataColumnMapping("LastName", "LastName"), New System.Data.Common.DataColumnMapping("PreferredName", "PreferredName")})})
'
'MDData
'
Me.MDData.ConnectionString = "Data Source=CIS1022DAVID;Initial Catalog=CGData;Integrated Security=True;Pooling" & _
"=False"
Me.MDData.FireInfoMessageEventOnUserErrors = False
'
'DsAuthorLogin
'
Me.DsAuthorLogin.DataSetName = "DsAuthorLogin"
Me.DsAuthorLogin.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
CType(Me.DsAuthorLogin, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents MDData As System.Data.SqlClient.SqlConnection
Friend WithEvents DaAuthorLogin As System.Data.SqlClient.SqlDataAdapter
Friend WithEvents DsAuthorLogin As MedicalDecisions.DsAuthorLogin
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs)
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'no code here
End Sub
Private Sub AuthorLoginRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginRegister.Click
'for new author registration
Response.Redirect("AuthorInformation.aspx")
End Sub
Private Sub AuthorLoginBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginBack.Click
'to navigate back
Response.Redirect("MainPaths.aspx")
End Sub
Protected Sub AuthorLoginPassword_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginPassword.TextChanged
'pass the parameters to the dataadapter and return dataset
DaAuthorLogin.SelectCommand.Parameters("@AuthorEmail").Value = AuthorLoginEmail.Text
DaAuthorLogin.SelectCommand.Parameters("@AuthorPassword").Value = AuthorLoginPassword.Text
MDData.Open()
DaAuthorLogin.Fill(DsAuthorLogin, "T_Author")
MDData.Close()
'set session objects
If DsAuthorLogin.T_Author.Rows.Count > 0 Then
Session("AuthorAlias") = DsAuthorLogin.T_Author(0).AuthorAlias
Session("LastName") = DsAuthorLogin.T_Author(0).LastName
Session("PreferredName") = DsAuthorLogin.T_Author(0).PreferredName
Response.Redirect("AuthorPaths.aspx")
Else : AuthorLoginNotValid.Visible = True
AuthorLoginEmail.Text = ""
AuthorLoginPassword.Text = ""
End If
End Sub
End Class
 
Thanks in advance,
David

View 2 Replies View Related

Error: The Script Threw An Exception: Object Reference Not Set To An Instance Of An Object.

Sep 12, 2006



Anyone know what this error means and how to get rid of it?



Public Sub Main()

Dim myMessage As Net.Mail.MailMessage

Dim mySmtpClient As Net.Mail.SmtpClient

myMessage.To(20) = New Net.Mail.MailAddress(me@hotmail.com)

myMessage.From = New Net.Mail.MailAddress(someone@microsoft.com)

myMessage.Subject = "as;dlfjsdf"

myMessage.Priority = Net.Mail.MailPriority.High

mySmtpClient = New Net.Mail.SmtpClient("microsoft.com")

mySmtpClient.Send(myMessage)

Dts.TaskResult = Dts.Results.Success

End Sub



Thanks,

View 4 Replies View Related

Predict Query Gives 'DMPluginWrapper; Object Reference Not Set To An Instance Of An Object' Error

Mar 17, 2008



Hi,

I am trying to develop a custom algorithm. I have implemented and tested training methods, however I fail at prediction phase. When I try to run a prediction query against a model created with my algorithm I get:


Executing the query ...
Obtained object of type: Microsoft.AnalysisServices.AdomdClient.AdomdDataReader
COM error: COM error: DMPluginWrapper; Object reference not set to an instance of an object..
Execution complete


I know this is not very descriptive, but I have seen that algorith doesn't even executes my Predict(..) function (I can test this by logging to a text file)
So the problem is this, when I run prediction query DMPluginWrapper gives exception -I think- even before calling my custom method.

As I said it is not a very descriptive message but I hope I have hit a general issue.

Thanks...

View 3 Replies View Related

Delete SQL Script As400 Throwing Object Reference Not Set To An Instance Of An Object

Apr 2, 2008

I am trying to send some data back to our as/400 from SQL server. Before I do so I need to delete entries from the table. I have an odbc connection set up and have used it sucessfully in a datareader compoenent but but when I try to use it for a delete SQL task it give me the followign error. what am I doing wrong? I even tried hardcoding in the system name/library name.

Here is my delete sql script
DELETE FROM DSSCNTL Where Companycode = 10


TITLE: SQL Task
------------------------------
Object reference not set to an instance of an object.
------------------------------
BUTTONS:
OK
------------------------------

View 7 Replies View Related

Object Reference Not Set To An Instance Of An Object. MSSQL Server Report Builder

Feb 15, 2007

When I try and run Report Builder Reports i get this error message "Object reference not set to an instance of an object. "

I can run reports locally but not from Report manager

here is the stack trace info

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:





An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:





[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Reporting.WebForms.WebRequestHelper.GetExceptionForMoreInformationNode(XmlNode moreInfo, XmlNamespaceManager namespaces) +18
Microsoft.Reporting.WebForms.WebRequestHelper.ExceptionFromWebResponse(Exception e) +358
Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) +482
Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +958
Microsoft.Reporting.WebForms.ServerReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileExtension) +84
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +143
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +75
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64





Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

View 3 Replies View Related

Power Pivot :: Cannot Save File Object Reference Not Set To Instance Of Object

May 13, 2015

Getting the following error-message:

OS: Windows Server 2008 R2 Standard
64bit
Office 2010

Power Pivot Tables are fed by Power Query queries.

View 3 Replies View Related

Microsoft Visual Studio Is Unable To Load This Document: Object Reference Is Not Set To An Instance Of An Object

Apr 8, 2008

Hi Everyone,
Please help me on this issue. I'm a new SSIS User.
I've installed Sql Server 2005 Developer Edition
When I create a new SSIS Project in Business Intelligence Development Studio,
I get the following message:
"Microsoft Visual Studio is unable to load this document: Object reference is not set to an instance of an object".
Error loading 'package.dtsx'bject reference is not set to an instance of an object
When I try to debug the package, I get the below message:
parameter Component(System.Design) is null.
I've uninstalled and installed SS 2005 several times, yet the problem persists.
Please help.
This is the package.dtsx

<?xml version="1.0"?><DTS:Executable xmlnsTS="www.microsoft.com/SqlServer/Dts" DTS:ExecutableType="MSDTS.Package.1"><DTSroperty DTS:Name="PackageFormatVersion">2</DTSroperty><DTSroperty DTS:Name="VersionComments"></DTSroperty><DTSroperty DTS:Name="CreatorName">USkothand1</DTSroperty><DTSroperty DTS:Name="CreatorComputerName">US6051KOTHAND1</DTSroperty><DTSroperty DTS:Name="CreationDate" DTSataType="7">4/8/2008 10:53:39 AM</DTSroperty><DTSroperty DTS:Name="PackageType">5</DTSroperty><DTSroperty DTS:Name="ProtectionLevel">1</DTSroperty><DTSroperty DTS:Name="MaxConcurrentExecutables">-1</DTSroperty><DTSroperty DTS:Name="PackagePriorityClass">0</DTSroperty><DTSroperty DTS:Name="VersionMajor">1</DTSroperty><DTSroperty DTS:Name="VersionMinor">0</DTSroperty><DTSroperty DTS:Name="VersionBuild">0</DTSroperty><DTSroperty DTS:Name="VersionGUID">{FBD98635-EDDE-4F58-9D53-356E8CB653FB}</DTSroperty><DTSroperty DTS:Name="EnableConfig">0</DTSroperty><DTSroperty DTS:Name="CheckpointFileName"></DTSroperty><DTSroperty DTS:Name="SaveCheckpoints">0</DTSroperty><DTSroperty DTS:Name="CheckpointUsage">0</DTSroperty><DTSroperty DTS:Name="SuppressConfigurationWarnings">0</DTSroperty><DTSroperty DTS:Name="ForceExecValue">0</DTSroperty><DTSroperty DTS:Name="ExecValue" DTSataType="3">0</DTSroperty><DTSroperty DTS:Name="ForceExecutionResult">-1</DTSroperty><DTSroperty DTS:Name="Disabled">0</DTSroperty><DTSroperty DTS:Name="FailPackageOnFailure">0</DTSroperty><DTSroperty DTS:Name="FailParentOnFailure">0</DTSroperty><DTSroperty DTS:Name="MaxErrorCount">1</DTSroperty><DTSroperty DTS:Name="ISOLevel">1048576</DTSroperty><DTSroperty DTS:Name="LocaleID">1033</DTSroperty><DTSroperty DTS:Name="TransactionOption">1</DTSroperty><DTSroperty DTS:Name="DelayValidation">0</DTSroperty>

<DTS:LoggingOptions><DTSroperty DTS:Name="LoggingMode">0</DTSroperty><DTSroperty DTS:Name="FilterKind">1</DTSroperty><DTSroperty DTS:Name="EventFilter" DTSataType="8"></DTSroperty></DTS:LoggingOptions><DTSroperty DTS:Name="ObjectName">Package</DTSroperty><DTSroperty DTS:Name="DTSID">{191D188C-EA6E-46D6-A46A-8C9F3C21C321}</DTSroperty><DTSroperty DTS:Name="Description"></DTSroperty><DTSroperty DTS:Name="CreationName">MSDTS.Package.1</DTSroperty><DTSroperty DTS:Name="DisableEventHandlers">0</DTSroperty></DTS:Executable>
Thanks
Best Regards

View 12 Replies View Related

Problem In Converting MS Access OLE Object[Image] Column To BLOB (binary Large Object Bitmap)

May 27, 2008

Hi All,
i have a table in MS Access with CandidateId and Image column. Image column is in OLE object  format. i need to move this to SQL server 2005 with CandidateId column with integer and candidate Image column to Image datatype.
its very udgent, i need any tool to move this to SQL server 2005 or i need a code to move this table from MS Access to SQL server 2005 in C#.
please do the needfull ASAP. waiting for your reply
with regards
 
 
 

View 1 Replies View Related

VS 2005 Error 'Object Reference Not Set To An Instance Of An Object' With Integration Services Project Create Failure

May 22, 2008



Just installed VS 2005 & SQLServer 2005 clients on my workstation. When trying to create a new Integration Services Project and start work in the designer receive the MICROSOFT VISUAL STUDIO 'Object reference not set to an instance of an object.' dialog box with message "Creating project 'Integration Services project1'...project creation failed."

Previously I had SQLServer 2000 client with the little VS tool that came with it installed. Uninstalled these prior to installing the 2005 tools (VS and SQLServer).

I'm not finding any information on corrective action for this error.

Any one have this problem and found the solution?

Thanks,
CLC

View 1 Replies View Related

Object Reference Not Set To An Instance Of An Object (Inserting Data Into Database)

Dec 28, 2004

Each time I press submit to insert data into the database I receive the following message. I use the same code on another page and it works fine. Here is the error:


Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 125: MyCommand.Parameters("@Balance").Value = txtBalance.Text
Line 126:
Line 127: MyCommand.Connection.Open()
Line 128:
Line 129: Try


Source File: c:inetpubwwwrootCreditRepairCreditor_Default.aspx.vb Line: 127

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
CreditRepair.CreditRepair.Vb.Creditor_Default.btnSaveAdd_Click(Object sender, EventArgs e) in c:inetpubwwwrootCreditRepairCreditor_Default.aspx.vb:127
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()



Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

If (Page.IsValid) Then

Dim DS As DataSet
Dim MyCommand As SqlCommand

Dim AddAccount As String = "insert into AccountDetails (Account_ID, Report_ID, Balance) values (@Account_ID, @Report_ID, @Balance)"

MyCommand = New SqlCommand(AddAccount, MyConnection)

MyCommand.Parameters.Add(New SqlParameter("@Account_ID", SqlDbType.Char, 50))
MyCommand.Parameters("@Account_ID").Value = txtAccount_ID.Text

MyCommand.Parameters.Add(New SqlParameter("@Report_ID", SqlDbType.Char, 50))
MyCommand.Parameters("@Report_ID").Value = txtReport_ID.Text

MyCommand.Parameters.Add(New SqlParameter("@Balance", SqlDbType.Char, 50))
MyCommand.Parameters("@Balance").Value = txtBalance.Text

MyCommand.Connection.Open()

MyCommand.ExecuteNonQuery()

Response.Redirect("Customer_Details.aspx?SS='CustHeadGrid.Columns[0].Item.lblSS.Text)")

MyCommand.Connection.Close()
End If

View 2 Replies View Related

Script Task Error --Object Reference Not Set To An Instance Of An Object

Sep 13, 2006

I am trying to execute this code feom Script task while excuting its giving me error that "Object reference not set to an instance of an object." The assemblies Iam referening in this code are there in GAC. Any idea abt this.



Thanks,

Public Sub Main()

Dim remoteUri As String

Dim fireAgain As Boolean

Dim uriVarName As String

Dim fileVarName As String

Dim httpConnection As Microsoft.SqlServer.Dts.Runtime.HttpClientConnection

Dim emptyBytes(0) As Byte

Dim SessionID As String

Dim CusAuth As CustomAuth

Try

' Determine the correct variables to read for URI and filename

uriVarName = "vsReportUri"

fileVarName = "vsReportDownloadFilename"

' create SessionID for use with HD Custom authentication

CusAuth = New CustomAuth(ASCIIEncoding.ASCII.GetBytes(Dts.Variables("in_vsBatchKey").Value.ToString()))



Dts.Variables(uriVarName).Value = Dts.Variables(uriVarName).Value.ToString() + "&" + _

"BeginDate=" + Dts.Variables("in_vsBeginDate").Value.ToString() + "&" + _

"EndDate=" + Dts.Variables("in_vsEndDate").Value.ToString()

Dim request As HttpWebRequest = CType(WebRequest.Create(Dts.Variables(uriVarName).Value.ToString()), HttpWebRequest)

'Set credentials based on the credentials found in the variables

request.Credentials = New NetworkCredential(Dts.Variables("in_vsReportUsername").Value.ToString(), _

Dts.Variables("in_vsReportPassword").Value.ToString(), _

Dts.Variables("in_vsReportDomain").Value.ToString())

'Place the custom authentication session ID in a cookie called BatchSession

request.CookieContainer.Add(New Cookie("BatchSession", CusAuth.GenerateSession("EmailAlertingSSIS"), "/", Dts.Variables("in_vsReportDomain").Value.ToString()))

' Set some reasonable limits on resources used by this request

request.MaximumAutomaticRedirections = 4

request.MaximumResponseHeadersLength = 4

' Prepare to download, write messages indicating download start

Dts.Events.FireInformation(0, String.Empty, String.Format("Downloading '{0}' from '{1}'", _

Dts.Variables(fileVarName).Value.ToString(), Dts.Variables(uriVarName).Value.ToString()), String.Empty, 0, fireAgain)

Dts.Log(String.Format("Downloading '{0}' from '{1}'", Dts.Variables(fileVarName).Value.ToString(), Dts.Variables(uriVarName).Value.ToString()), 0, emptyBytes)

' Download data

Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)

' Get the stream associated with the response.

Dim receiveStream As Stream = response.GetResponseStream()

' Pipes the stream to a higher level stream reader with the required encoding format.

Dim readStream As New StreamReader(receiveStream, Encoding.UTF8)

Dim fileStream As New StreamWriter(Dts.Variables(fileVarName).Value.ToString())

fileStream.Write(readStream.ReadToEnd())

fileStream.Flush()

fileStream.Close()

readStream.Close()

fileStream.Dispose()

readStream.Dispose()



'Download the file and report success

Dts.TaskResult = Dts.Results.Success

Catch ex As Exception

' post the error message we got back.

Dts.Events.FireError(0, String.Empty, ex.Message, String.Empty, 0)

Dts.TaskResult = Dts.Results.Failure

End Try

End Sub

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved