Showing posts with label retrieves. Show all posts
Showing posts with label retrieves. Show all posts

Thursday, March 29, 2012

Getting a single value from SqlDataSource

Hi,

I have a SqlDataSource(named SQLDS1) which retrieves 4 value from database(ProductName,ProductCost,ProductID). I Have a DropDownList(DDL1) control and its DataSource SQLDS1.

DDL1 Selected data field todisplay is ProductName
DDL1 Selected data field tovalue is ProductCost

I did all this in Visual Part without any line of code. But in the code behind , When i select an item from DDL1 i need its ProductName,ProductCost and Also ProductID. It is simple to get first two. But how can i get the ProductID. Is there anyway to get ProductID from SQLDS1.

Happy Coding

Hi

You will be able to obtain only the values that you bind to the drop down list. if you want non bound value then you will have to fire another query based on what you select from the drop down.

For example,

select productid from Table_name where product name = 'prodname you selected from ddl' and productcost= cost you got from ddl.

Then use productid as you need

HTH

Wednesday, March 21, 2012

GetBlobData method fails

Hi,

I have s Script Component, that retrieves data from NTEXT column using this code:

Dim b As Byte()

If (Row.OutputXML.Length > 0) And (Not (Row.OutputXML_IsNull)) Then

b = Row.OutputXML.GetBlobData(0, CInt(Row.OutputXML.Length))

End If

I′m getting this error:

[Script Component 1 [838]] Error: System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper90 wrapper, Int32 inputID, IDTSBuffer90 pDTSBuffer, IntPtr bufferWirePacket)

OutputXML column is filled by Ole Db Command from an output parameter (nvarchar(max)) of a stored procedure. In management studio sp works fine, even Execute SQL Task returns correct (but truncated) data.

Please, help!

what is the SSIS data type (not the original SQL data type) assigned in OleDB Command to OutputXML column?|||data type is DT_NTEXT