ADO.NET :: Is It Possible To Save "Collections" To A Single Varbinary(MAX) Field/column In A SQL Server 2008

Oct 9, 2010

I was thinking about the fastest way to retrieve a "set" of objects related to a specific user. For instance, if I was to create a website similar to Flickr where people upload lots and lots of photos(jpegs) what would be the fastest way to be able to retrieve those photos from the SQL Server database. Scenario 1: You store metadata about each file they upload to the website as a single row in a database table. Then when you want to retrieve a specific users uploaded files you simply scan the database file for every row matching the UserID and store them in memory.

SELECT PictureId, UserId, PathToFile, Caption, (etc.)

FROM Photos

WHERE UserId=@UserId

This, of course, gets all the information about all the photos a single user has uploaded. My concern with this approach is when the user activity goes from a few thousand to being in excess of a million.

This approach seems fine for a small website but does this method work for a million plus user website like Flicker or MySpace? When you have a million users and millions more photos does this approach still perform at acceptable speeds?

create a collection in memory of "ALL" the PictureIds' for a single user and store them in-memory, in a collection and then save this collection as a single VARBINARY(MAX) field in the SQL Server Database. So instead of having to find multiple records in the Photos database you would simply need to find one, which would include all the PhotoIds' that belong to the user. In essence, translating into the phrase, "If you find one, you have found them all". And improving server performance by leaps and bounds. I only have about a year experience in working with SQL Server and ASP.NET so Im not sure if this solution is practical, if its already been tried, if it can be done.

View 1 Replies


Similar Messages:

Save Byte To Varbinary (64) Field In Database

Jun 7, 2010

I have

byte[] a = HashEncrypt("a");
with
public byte[] HashEncrypt(string password)
{
SHA512Managed sha = new SHA512Managed();
byte[] hash = sha.ComputeHash(UnicodeEncoding.Unicode.GetBytes(password));
return hash;
}

I want to save byte[] a to my database. My database field is a varbinary(64). I'm using SQL Server 2008. I want to know the insert query with C# code. I am using ADO.NET

View 1 Replies

Web Forms :: Read File From Sql Server Varbinary (max) Field?

Dec 20, 2010

I have a function that will take a file uploaded by a user of my system and store the contents of the file into a varbinary(max) field in a sql server database. I then display the filename of the file in a data grid for the user to see as a link button. When the user clicks on the link button, I want the file to be read from the database and served out to the user as a prompt to download the file. How can this be accomplished? The upload is fine, it is the download I can't figure out. Here is what I have so far.

[Code]....

I get the download to prompt, but it is showing the name of my .aspx page as the file to be downloaded.

View 1 Replies

SQL Reporting :: How To Sort Column Field And Add TOTAL Column In VS 2008

Dec 9, 2010

I am in VS2008 and in ReporViewer's Design page.

I have "Fruits" as column fields and Months as row fields and Sales as data field.

I have these columns:-

Apple, Orange, Pear.

However, I want it be displayed as

Orange, Pear, apple.

Any work around ?

Also I need a 4th column adding the Apple, Orange and Peer numbers total. How to do it in design view in VS2008 ?

View 4 Replies

Sql - Fileupload To Varbinary FileStream Field?

Feb 8, 2010

I want to upload files from fileupload control and save them as varbinary Filestream in the database.

First of all, does this make sense? Would you recommend this?

Then, how does it work? I want to be able to upload Imagefiles as well as .doc and .xls.

so when i have uploaded a .xls, how would i save it to the Database(i'm going to use Linq2Entities).

View 2 Replies

DataSource Controls :: How To Pass Null Value Into Varbinary(max) Column N To By Table

Feb 14, 2010

i want to pass null value into varbinary(max) column n to by table

if i do like this i have this function in my app_code .vb class

Public Function Remove_Attachment(ByVal Id As Integer) As Integer
Try
Dim db As New dbAccess
db.commandText = "SP_RemoveAtt_DML"
db.commandType = CommandType.StoredProcedure
db.addParameter("@InOutVal_Id", Id)
db.addParameter("@Document", System.Data.SqlTypes.SqlBinary.Null.Value)
db.executeQuery()
Catch ex As Exception
Throw ex
End Try
End Function

i got this error. Data is Null. This method or property cannot be called on Null values.

View 4 Replies

ADO.NET :: Getting DataReader Field Text To System.Collections.IEnumerator

Feb 22, 2011

cmd_again =
new
SqlCommand
();
cmd_again.CommandText =
"select * from QMS_Processes1 where QMSParentProcessId=" +
id + ";"
;
cmd_again.CommandType =
CommandType
.Text;
cmd_again.Connection = con_again;
rdr_again = cmd_again.ExecuteReader();
System.Collections.
IEnumerator
ienum = rdr_again.GetEnumerator();
while
(ienum.MoveNext())
{}

now i want 3 fields in datareader how do i get that?? i tried to create instance of System.data.common.dataRecordInternal..but it didnt happen.

View 4 Replies

Populate Label From Single Field In Sql Server?

Sep 15, 2010

I have a column in a table that contains a message and I want this message to be displayed in a label. Here is my code which currently doesn't populate the label.

Protected conString As String = ConfigurationManager.AppSettings("sqldirectory")
Dim cnn As New SqlConnection(conString)
Dim cmd As New SqlCommand("select message from [database].[dbo].[table]")
Dim dr As SqlDataReader
Try
cnn.Open()
dr = cmd.ExecuteReader()
lblMsg.Text = dr(0).ToString
Catch ex As Exception
dr = Nothing
Finally
cnn.Close()
End Try

View 1 Replies

SQL Insert - How To Combine More Than One Field Value To A Single Column Insert

Jan 18, 2010

I have a form with many form fields and controls, with some offering an "other" if a value does not meet the needs for the user. How can I bind the sql insert so that it will take the ddl selection along with the txt field selection for the "other" value? Even if the txt field is empty it should not be a big deal since the ddl would provide something other than null. Since the column in the db does not allow nulls. I'm using asp.net (vb) 3.5 sp1

View 3 Replies

Web Forms :: Sum Up 2 Field As A New Column - SubTotal In Microsoft Visual Studio 2010 Sql Express 2008

Aug 14, 2010

How to do sum 2 differences fields as a new column in Subtotal ? I know to do in Microsoft Access and that is easier.

View 2 Replies

SQL Server :: How To Use Distinct On A Single Column From A List Of Columns

Jan 21, 2011

I would like to know if there is a way that I can use DISTINCT on one column's values but need to show other columns where the value of the DISTINCT column is equal to another table's column

View 7 Replies

SQL Server :: How To Calculate A Column Data For Different Conditions Using Single Query

Jan 12, 2011

I am using below query to count a particular column data based on single condition.

[code].....

But I have to calculate for 3 more conditions. Is it possible to count based on 3 conditions(i.e. 2001 - 3000,3001 - 4000, 4001 - 5000,>5000) and I want result set for all the conditions?

View 8 Replies

SQL Server :: Various Data Type Save In One Field?

Sep 28, 2010

I use a ntext data type for all kind of data save in one field, but when i save byte (that converted from image) follwing message is shown "Operand type clash: varbinary(max) is incompatible with ntext". Is ntext suitable for all kind of data type or what will be compatible for all data type support?

View 2 Replies

SQL Server :: How To Combine The Data From The Two Text Boxes And Store It In Single Column

Jul 30, 2010

I have two textboxes

1.To get the Hour

2.To get the Minutes

From user.

And in the back end... i would to Combine the data from these text boxes and store it in single column..
For eg.

If textboxHours.Text="11";
textboxMinuetes.Text="56";
In the backend it should store like..
MeetingTime (column name)
11.56

View 2 Replies

SQL Server :: Combine Strings Separated By Single White Space In Column

Mar 10, 2011

i have a column in table and need to combine words seperated by single space, i am using sql server 2005.

DECLARE @text varchar(256)
SELECT @text = 'Micro Tech'

--required output MicroTech

View 3 Replies

C# - Uploading Files To Varbinary(max) In SQL Server -- Works On One Server Not The Other

Jun 16, 2010

I have some code that allows users to upload file attachments into a varbinary(max) column in SQL Server from their web browser. It has been working perfectly fine for almost two years, but all of a sudden it stopped working. And it stopped working on only the production database server -- it still works fine on the development server.

I can only conclude that the code is fine and there is something up with the instance of SQL Server itself. But I have no idea how to isolate the problem.

I insert a record into the ATTACHMENT table, only inserting non-binary data like the title and the content type, and then chunk-upload the uploaded file using the following code:

[code].....

View 1 Replies

SQL Server :: Save 2 Values In The Same Column?

Aug 7, 2010

how to save 2 values in the same column.

Example:

Nickname
programmer
programer2
programer3

My column:

Nickname
programmer
programer2
programer3

My code:

<Asp: textbox ID = "TextBox1" runat = "server" Text ='<%# Bind ("Nickname")%> '/>
<Asp: textbox ID = "TextBox2" runat = "server" Text ='<%# Bind ("Nickname")%> '/>
<Asp: textbox ID = "TextBox3" runat = "server" Text ='<%# Bind ("Nickname")%> '/>

How do I use Insert Into to be stored two values in the column at the same time?

View 3 Replies

SQL Server :: How To Get Month And Year In Single Column And Grouping The Data For All The Years And Months

Jan 10, 2011

For the below query (sdate is column name and table name is storedata)

View 2 Replies

State Management :: Save The Viewstate At The Server Side Instead Of __VIEWSTATE Hidden Field?

Feb 10, 2011

i am facing the following problem while saving the viewstate on the server side using the savepagestatetopersistencemedium, but this is not working for the pages which contains update panel.

View 2 Replies

SQL Server :: How To Sum Each Column Values In 2008

Oct 6, 2010

my requirement is to sum the values in each columns in table and displays in total.

I used stored procedure to get 5 rows with values, but i need to total value for each column in bottom row. Like

[code]....

I need to get the total for each column in footer in sql server.

View 6 Replies

SQL Server :: Implicit Conversion From Data Type Sql_variant To Varbinary Is Not Allowed?

Oct 25, 2010

Here are my codes:

[Code]....

And here's the error I got:

Implicit conversion from data type sql_variant to varbinary is not allowed. Use the CONVERT function to run this query.

Description:

An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Implicit conversion from data type sql_variant to varbinary is not allowed. Use the CONVERT function to run this query.

View 20 Replies

Web Forms :: Sql-server-2008 Database That Contain Image Field That Hold Picture?

Dec 21, 2010

i have sql-server-2008 database that contain image field that hold picture.

i have pictureBox control in my webform.

how to put picture from database to pictureBox control ?

(i work with C# asp.net FW3.5)

can i get any sample code or program ?

View 2 Replies

DataSource Controls :: Modify Column Properties In SQL Server 2008?

May 17, 2010

I create a table in SQL server 2008 and add some colume

after sometime i need to change some properties of colume

but problem come when saveing the table. Error message shown:-

Saving changes are not permitted.the changes you have made required the table to be droped and re-created .you have either made changes to a table that can't be re-created or enabled the option prevent saving changes that required the table to be re-created.

View 5 Replies

SQL Server :: Want That Whenever User Left This Field Blank From Front End Aspx Page, Null Value Should Be Inserted In This Column From Stored Proc?

Oct 27, 2010

I have a table in sql having a numeric data type column,Now i want that whenever user left this field blank from front end aspx page, null value should be inserted in this column from stored proc.How can i achieve this? Also what kind of data type is most appropriate on front end for such taking kind of value?

View 2 Replies

Visual Studio :: How To Upload Excel Sheet In Vs2008 And Save The Excel Data In Sql Server 2008

Mar 9, 2010

I want how to upload the excel sheet data and that data will save in Sql Server 2008(table).

View 2 Replies







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