View Full Version : How to store Articles ?
:salams
Upto now I've been using one large .doc file for storing all islamic articles (e.g. questions and answers from Ummah/Islam QA etc.) But it is getting very difficult to retrieve a specific data later. I am thinking of creating a small application (e.g. VB.net) where I can store all the data in a database so that I can view those later by selecting the topic. But I just found out that MS access only allows 255 characters per field.
So, what's the way to store large data and retrieve those at a later time? For example, how are the data on this forum stored?
ammarcool
09-09-07, 05:34 AM
brother it will be stored in database as a bytestream, BLOB Objects! your can use SQL Server 2005.
:jkk: for your reply.
I am completely new to bytestreams and BLOB objects...need to do some reading on google.
However, can I do this with MS Access? I am kinda reluctant using SQL Server or mySQL for such small applications as these require seperate installations.
ammarcool
09-09-07, 06:01 AM
for your reference:
Storing Uploaded Files in a Database or in the File System with ASP.NET 2.0 (http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=414)
Save an Image to SQL Server (http://www.vbdotnetheaven.com/UploadFile/scottlysle/ImageToSqlServer11242006025136AM/ImageToSqlServer.aspx)
Save image to database in ASP.NET 2.0(VB) (http://www.aspnettutorials.com/tutorials/database/Save-Img-ToDB-VB.aspx)
ammarcool
12-09-07, 08:13 AM
mports System.IO
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Dim con As SqlClient.SqlConnection
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
con = New SqlClient.SqlConnection("ConnectionString")
con.Open()
Dim fstream As New FileStream(TextBox2.Text, FileMode.Open, FileAccess.Read)
Dim buf(fstream.Length) As Byte
fstream.Read(buf, 0, fstream.Length)
fstream.Flush()
fstream.Dispose()
Dim com As New SqlClient.SqlCommand()
With com
.Connection = con
.CommandType = CommandType.StoredProcedure
.CommandText = "SaveDoc"
.Parameters.Add("@WordName", SqlDbType.NVarChar, 50).Value = TextBox1.Text
.Parameters.Add("@WordFile", SqlDbType.Binary).Value = buf
.ExecuteNonQuery()
End With
com.Parameters.Clear()
com.Dispose()
con.Dispose()
MessageBox.Show("Save Successfully", "Doc", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
End Class
Table SQL Script
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WordFile]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[WordFile]
GO
CREATE TABLE [dbo].[WordFile] (
[WordID] [int] IDENTITY (1, 1) NOT NULL ,
[WordName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[WordDoc] (50) NOT NULL
) ON [PRIMARY]
GO
[B]SP SQL Script
CREATE PROC SaveDoc (@WordName NVARCHAR (50),@WordFile BINARY)
AS
INSERT INTO
WordFile
(WordName,WordDoc)
VALUES
(@WordName,@WordFile)
GO
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.