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

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

Converting Data From Table to String...

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net


I have a quick question concerning SQL. In the page load event, I am tryinging to enable an option for a person who originally created the article to edit it. I am trying to pull the data from the varible which is populated with right data...but am unsure of the command. With the code shown the problem is clear...


If Not Request.QueryString("id") Is Nothing Then
            Dim i As Integer = Convert.ToInt32(Request.QueryString("id"))
            Dim a As New ArticlesDataSet.ArticlesDataTable
            Dim _ArticlesBBL As New ArticlesBLL
            Dim b = _ArticlesBBL.GetDataByArticleID(i)
            If User.Identity.Name <> b.ArticleCreatedByColumn.ToString Then
                txtTitle.Text = b.ArticleTitleColumn.ToString
                mceBody.Text = b.ArticleBodyColumn.ToString
                mceSummary.Text = b.ArticleSummaryColumn.ToString
                txtExpDate.Text = b.ArticleExpirationDateColumn.ToString
            End If
        End If
        If Not Page.User.Identity.IsAuthenticated Then

 If someone could lead me in the right direction I would be Greatful...



View Complete Post

More Related Resource Links

Split a String from a listbox to enter data in a table


Currently, I have a listbox that the selected items are inserted into the database by a string. Now I need to add a new feature that the searches are suppose to be postback individually so the selected values from the listbox need to be inserted into the database individually so the search can work. Is it possible to split an string into separate variables or into an array?

Thanks for your help,



Following is my store procedure and my back code:

<script runat="server">
    Protected Sub insertcompanydata_click1(ByVal sender As Object, ByVal e As EventArgs)

        Dim tobresults2 As String        
        Dim li As ListItem
        Dim myArrayList As ArrayList = New ArrayList()
        Dim strarr() As String
        For Each li In txttoblb.Items
            If li.Selected = True Then
            End If

        strarr = myArrayList.ToArray(Type.GetType("System.String"))
        tobresults2 = String.Join(",  ", strarr)

        Dim txtloblb1 As String
        Dim lin As ListItem
        Dim myArrayList1 As ArrayList = New ArrayList()
        Dim strarr1() As String

extract picture data from a string


dears,advance thanks.can anybdy help to solve my problem which is describing below.

Example- %%D1,100,0,0004[data...][0d0a]

Head - %%D1
Amount of data package -100
The data package No. - 0
Data Length -1024 (0004 (low bit in front, high bit in back) 0004= 0x0400=1024;)

data- Original Picture data -1024(maximum)
Tail -0x0d0a
Data in hex

from the above example i want to extract picture data and need to store in to the sql table.sql table columname is image and datatype is also image.after that i wanted to display this image column to an aspx page.

expecting help asap.

Checkboxes from data table


I have a data table that contains some values for Certifications.  This table can be updated in a different part of my application.  On the web page I am currently working on, I would like to have check boxes appear for every value in the data table.  I have been struggling with this trying to use a For Each loop and I cannot get it to work for anything.  Any suggestions? 

I am using the following Razor syntax to obtain my data (I know this works because I can display it in a WebGrid):


var db = Database.Open("MyConn");

WebMatrix conversion failed when converting from a character string to uniqueidentifier?


I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

It takes 3 parameters and 1 exception.

myDll.GetXML(year, username, uniqueidentifier, out ex);

When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

Or a stack of.

System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

   at System.Data.SqlClient.SqlDataReader.get_MetaData()

   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha

How to get data from table based on four table



I need to know how to show top 30 records from four table

with fastest speed.. in ms sql server 2005..

hope You do the needfull


Data Points: Deny Table Access to the Entity Framework Without Causing a Mutiny


Julie Lerman shows database administrators how to limit access to databases from the Entity Framework by allowing it to work only with views and stored procedures instead of tables-without impacting application code or alienating developers.

Julie Lerman

MSDN Magazine August 2010

Data Points: Windows Azure Table Storage - Not Your Father's Database


Let go of your traditional relational database thinking if you want to understand how Windows Azure Table storage works, says Julie Lerman. Luckily for you, she's done the hard work to grasp the new concepts and help you get up to speed.

Julie Lerman

MSDN Magazine July 2010

Under the Table: Visualizing Spatial Data


In this article, the author shows you three new arrivals on the SQL Server spatial visualization scene: the map control in SQL Server 2008 R2 Reporting Services (SSRS), the ESRI MapIt product, and the MapPoint Add-In for SQL Server 2008.

Bob Beauchemin

MSDN Magazine November 2009

Under the Table: How Data Access Code Affects Database Performance


In this article, the author delves into some commonly used ways of writing data access code and looks at the effect they can have on performance.

Bob Beauchemin

MSDN Magazine August 2009

Under The Table: Spatial Data Support In SQL Server 2008


New spatial data support in SQL Server 2008 opens the door to mapping and querying geometric and geographic data, allowing you to build exciting new applications.

Bob Beauchemin

MSDN Magazine February 2009

Data Points: Common Table Expressions


In T-SQL, views and derived tables serve similar purposes and have their advantages. But when working with SQL Server 2005,there's a third option--using Common Table Expressions (CTEs). John Papa explains.

John Papa

MSDN Magazine October 2007

Error converting data type varchar to numeric.


I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


need your help regarding table and database.. without data lose



I have a table like this in database

ItemNo ItemName Qty  

001       A               50       

002       A               20      

003       B               50  

004       C               60      

005       D               40 

006       E               90      

upto it has some 3000 rows in table..

Now what my problem is i have one more field in mydevelopment PC let us consider another column Category

I need to update this column to my client pc without losing 3000 data from table which already exist...

How to do...?

Entity Data Model and database view returning the same columns as there are in a table


When adding a stored procedure into the Entity Data Model I can select whether the procedure returns a scalar, a (new) complex type or one of the entity types I already defined. 

How do I do something similar for a view?

I mean assuming I have a view like this

CREATE VIEW FilteredFoos as SELECT Foo.* FROM Foo join ... WHERE ...

(that is a view that implements some involved filtering, but returns all columns from one table) how do I add it to the project so that I can use the entity set, but get the Foo objects, not some new FilteredFoo objects.

var foos = myDB.FilteredFoos.Include("Bar").ToList();

foreach (Foo foo in foos) { ...

Thanks, Jenda

How to create scrolling table for columns in a SharePoint Designer Data View


I have a fairly complex SharePoint Designer 2007 Data View they have added two more requirements.

1. Have the columns on the right side be able to scroll left to right as there is a large number of columns, while the first 3 columns on the left side stay locked in place.  This is only one list not two, and because of some other requirements I have it must remain to be just one list.

2. Then they also need to have scrolling up and down of the entire list with the headers locked in place.

The first requirement is more important than the second, but preferrably I need to do both.

I am new to XSL so not familar with the syntax. Is this something I can do on a custom Data View? Does anyone have any examples of how?

I have a drawing that show how it needs to look but I don't see an option here to upload a graphic.

So here is a link to my graphic example uploaded to my blog area: http://lindachapman.blogspot.com/  or just the image here: http://4.bp.blogspot.com/_aB01ue__NvQ/TGL42MOvrGI/AAAAAAAAAA4/c3xP4uCy4BU/s1600/Scrolling.png

I failed to mention that 3/4 of the columns are HTML Calculated fields wh

how to search the table name on th basis of data.


is there any way to search the table name containing a specific data  in a given database.

for example, if i have any data, say "Euro" in hand, and i know any of the table in database contain the given value, however i'm not sure which table. So if i can list out the table anyhow containing the data in hand. 

Reading xml data from xml string




i have string like below:

<?xml version="1.0" encoding="utf-8" ?>










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