.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

DataTable to a binary field on data base

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net


Is it possible to convert a datatable into binary data and save it into on a binary field on database?

View Complete Post

More Related Resource Links

"String or binary data would be truncated" and field specifications

Hi all,   i have "String or binary data would be truncated" error when i try to execute an insert statment.   can i find witch field is affected by this error? (for return it to the user)   thank's all

Data Points: DataSet and DataTable in ADO.NET 2.0


ADO. NET 2. 0 sports some exciting enhancements to the core classes found in ADO. NET 1. x and introduces a variety of new classes, all of which promise to improve performance, flexibility, and efficiency.

John Papa

MSDN Magazine November 2005

Linq getting data from field on record



   I would assume this is possiable but I cannot seem to find it anywhere. I just one the contents of a single field, I don't see why I have to return the how

record to get get that information, here is my current code, how can I make this better without returning the entire record, for just getting contents of one field.

var patternrecord = storedb.Patterns_Table.Single(a => a.Pattern_GUID == id);
PMEDIA.Pattern_Key = patternrecord.Pattern_Key;

change calendar date backColor base on data from db


I want to  change calendar date backColor base on data from db,  I only have vistual 2003 !

on mean time I have

<asp:DataGrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 23px; POSITION: absolute; TOP: 271px"
		    runat="server" Font-Size="XX-Small" Font-Names="Verdana" AutoGenerateColumns="False" Visible="False">
           <asp:BoundColumn DataField="subject" HeaderText="Title"></asp:BoundColumn>
           <asp:BoundColumn DataField="posttimestart" HeaderText="Post date"></asp:BoundColumn>


Sub DayRender(ByVal source As Object, ByVal e As DayRenderEventArgs)
        Dim i As Integer
        For i = 0 To DataGrid1.Items.Count - 1
            If (DataGrid1.Items(i).Cells(1).Text = e.Day.Date) Then
                e.Cell.BackColor = Color.DarkOrange

            End If

    End Sub

when I click the day wich have data in db it change  color , but I want the page load it change color !

Thank you!

Combining data from 2 lists, then summing a field


I have 2 lists, one is a contact list (client, client title, address, etc.), the other is a list of meetings with these clients (client name, type of meeting, date, etc.).  The 2nd list has multiple entries for the same client.  I am trying to create a report that combines the data in these lists and displays them like this:

Client--Client Title--MeetingType1--MeetingType2




In addition to combining the list data, I also need to break up the Type of Meeting field and sum the number of different types of meetings for each client.  I added the 2 lists to a linked source, then inserted the data into a DVWP adding data from the 2nd list as a joined subview.


I tried this: xsl:value-of select="count(/dsQueryResponse/Rows/Row[@TypeOfMeeting = 'MeetingType1'])" but it just returns 0.  I'm not sure if that's the correct method though as I think it will return a count of ALL the rows, not the current row.  Any ideas would be appreciated!

How do you create a custom BDC data field that allows for multiple selected values?

I need help creating a custom data field using the BDC column as a base.  We need to allow for multiple selected values instead of just a single one.  I can't find anything on the net which shows how to do this.

Create excel file from Binary data on SqlServer



My requirement is that i upload an excel file then i need to validate that data.


1. Uploading file using using upload control saving binary in SqlServer

2. Then i am creating file from binary data  on Sql Server using below command and then using OPENROWSET to dump data to Sql table

3. Then reading Sql Table row wise and validating data.


Alter Procedure spUploadExcelFile
  @PKID int,
  @BatchID int


	Declare @VarBin varbinary(max)
	Declare @FileName varchar(100)
	DECLARE @sql nvarchar(MAX)
                DECLARE @errMsg nvarchar(MAX)
	DECLARE @ObjectReturn INT
	DECLARE @ErrorSource VARCHAR(255)
	DECLARE @ErrorDesc VARCHAR(255)
	DECLARE @ObjectToken INT

	Select @VarBin  = Content , @FileName = [FileName] from MultilangBinaryData Where PKID = @PKID
	SET @FileName = 'C:\'  + @FileName
	EXEC sp_OACreate 'ADODB.Stream' @ObjectToken OUTPUT
	EXEC sp_OASetProperty @ObjectToken, 'Type', 1
	EXEC sp_OAMethod @ObjectToken, 'Open'
	EXEC sp_OAMethod @ObjectToken, 'Write', NULL, @VarBin
	EXEC sp_OAMethod @ObjectToken, 'SaveToFile', NULL, @FileName, 2
	EXEC sp_OAMethod @ObjectToken, 'Close'
	EXEC sp_OADestroy @ObjectToken  
	SET @sql = 'INSERT INTO dbo.UserBulkData SELECT 0,NULL,'+ @BatchI

"The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not


I tried to convert a project from ASP.NET 1.1 to 2.0 and found one big problem which stops the whole process.

An .aspx page from the subfolder "admin" includes a user control from the subfolder "common". Both subfolders ("admin" and "common" are in the root).

- admin
-- aspx page
- common
-- user control

The page works well when started from Visual Studio, but when the project is precompiled for deployment, the next error occurs:

"The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

I tried to use "Reference" in the .aspx page, but that doesn't work.

Does anybody know any workaround for this?

Extracting XML Data from a Field SQL Server 2005

I have extracted XML data in the past, but I have received data from a vendor and they basically dumped information into this one XML field.  I am having issues extracting and was wondering if someone might know how?Here is a sample snipit of the info: <form><text id="vwdateneeded" label="Date Needed *">2-2-09</text><text id="vwdesklocation" label="Desk Location *">kljklj</text><text id="vwreportsto" label="Reports To *">kjhjkh</text><text id="vwcostcenter" label="Cost Center *">jkhjklhj</text><select id="vwhardwarerequired" label="Hardware Required *" style="combo">IT Desktop<option label="" /><option label="Business Desktop">Business Desktop</option><option label="Business Laptop">Business Laptop</option><option label="IT Desktop">IT Desktop</option><option label="IT Laptop">IT Laptop</option><option label="IT Project Computer">IT Project Computer</option><option label="Other">Other</option></select><text id="vwcomments" label="Comments *" multiline="true">kjgjhg</text></form>' I took some help from an on

How to store binary data as nvarchar(max)?

I’m trying to store a blob of binary data as nvarchar(max) and it gets truncated after just a few bytes. I wonder why and how can I prevent it. I don’t use varbinary(max) because I’m trying to keep existing DB schema intact. Current DB contains a huge chunks of text in nvarchar(max) column and I’m trying to compress (zip) this text and store it back to the same field to reduce DB size.   DB is accessed using Sync Framework (and Entity Framework) on the client side, so actual DB engine is SQL Server Compact 3.5 SP2   Thank you! KonstantinThank you! Konstantin

How can i add prefix to any field data?

I have a table 'CLIENT' where i want to prefix 99 to all the existing customer IDs in the integer field 'CUID'. How can i do this? For eg. CUID 12 123 1234 will be: CUID 9912 99123 991234  LuxCoder

Read data from BLOB field and write to sharepoint list

Hi, I want to read the data from BLOB field and write it into sharepoint list item. Please provide some pointer to archive above objective.   Thanks in Advance.

Calculated date field displays differently in List View and Data View web parts

In SharePoint GUI I created a simple custom list with a calculated Date/Time field (Due).  The calculation is =[Created]+7.  I'm trying to display this data on a page using a DVWP.  But first, for testing purposes, I also created a second calculated Date/Time (TestCreate) field in my custom list that is simply =[Created]. In the List View from within SharePoint, the dates show as expected (for example): Created = 8/12/2010 3:45 PM Due = 8/19/2010 3:45 PM TestCreate = 8/12/2010 3:45 PM In SharePoint Designer, I added a Data View web part and the above three data elements (each configured to display mm/dd/yyyy hh:mm:ss tt).  I see the time displayed for the example list item as: Created = 8/12/2010 3:45:30 PM Due = 8/19/2010 10:45:00 AM TestCreate = 8/12/2010 10:45:00 AM I've tested a couple scenarios and the calculated fields always display five hours in the past (along with dropping the seconds).  It seems like the DVWP is returning the date in a different time zone (with no seconds).  The lcid is set right (1033).  I didn't see any time zone settings for the DVWP specifically.  I'm basically stuck.  Could someone help me figure this one out. Thanks.

Set up a validator that compare the value of the current field with an other (using Dynamic Data)

Hi! Most of it is in the title : I'd like have a validator on the DateTime_Edit template for example that allows to compare this field with an other DateTime field. My problem is when I am in the DateTime_Edit template of my "master field" (the one I want to check), how can I access to the other field given the architecture of Dynamic Data FieldTemplates? But perhaps I'm not thinking in a good way on this control. Any advice will be welcome. Thanks Raphaelp

SSAS 2008 Metadata Repository data - User Knowledge base

Hello, We have the SQL Server 2008 Analysis services instance with some databases, cubes, Dimensions, Measure groups, partitions, etc. The business users are find difficulty to search for a particular measure. I mean, it is difficult for them locate a measure from the available cubes; again finding the respective Measure Group/ Folder is not an easy task for them. Also, they need to know the source system of a particular attribute in a dimension, formula for the calculated measure and etc. So, we have planned to develop a knowledge repository, which needs to store the business metadata for the SSAS databases. The user needs to be access this information using the SharePoint site and should help them locate and understand the data. The User Interface needs to be user friendly too. I need your valuable suggestions for the design of this system. Note: I have referenced the below articles http://dwbi1.wordpress.com/2010/01/01/ssas-dmv-dynamic-management-view/ http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/c610850f-16b4-4eaf-9b91-a2d32816f40e

SQLBindparameter for binary sql data type.

How to use SQLBindparameter for binary data type of SQL? Please help and how to use SQLGetStmtAttr and SQLSetDescField for this?  Cheers!!! Vatsa
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend