How To Store File Attachments (text And Binary).

Nov 9, 2006

I need to store several different types of documents (text, MS Word, PDF, etc.) in SQL Server 2005. What is the best way to store file attachments that have different MIME types?

Currently I'm using a table with a varbinary(max) column which works for binary files but not for text files. Do I need to have multiple columns in the table for different file types? Thanks in advance for your help.


CREATE TABLE dbo.[CM_Attachment] (
[Id] int IDENTITY (1, 1) NOT NULL ,
[Change_Request_Id] int NOT NULL ,
[Attachment] varbinary(max) not null,
[Created_Date] datetime NOT NULL DEFAULT GetDate() ,
[Created_By] varchar(30) NOT NULL ,
[Modified_Date] datetime NOT NULL ,
[Modified_By] varchar(30) NOT NULL
)
GO


INSERT INTO CM_Attachment(Change_Request_Id, Attachment, Created_By, Modified_Date, Modified_By)
SELECT 6, BulkColumn , '', GetDate(), ''
FROM Openrowset( Bulk 'C:TestingTest Doc #1.txt', SINGLE_CLOB) -- Does not work
-- FROM Openrowset( Bulk 'C:TestingTest Doc #2.xls', Single_Blob) -- Works
-- FROM Openrowset( Bulk 'C:TestingTest Doc #3.jpg', Single_Blob) -- Works
as ChangeRequestAttachment

View 8 Replies


ADVERTISEMENT

How To Store File Binary Content

Dec 3, 2007

Hi,

I have never use sql server to store binary data. Now, I need to store a .doc file into it. Which column type I should adopt?

In addition, could you provide me related articles to study?

Thanks,
Ricky.

View 3 Replies View Related

T-SQL (SS2K8) :: Store Binary Data Rather Than Int Or Binary?

May 7, 2015

I'm using a bit-wise comparison to effectively store multiple values in one column. However once the number of values increases it starts to become too big for a int data type.you also cannot perform a bitwise & on two binary datatypes. Is there a better way to store the binary data rather than int or binary?

View 9 Replies View Related

Error Msg 6522, Level 16, State 1 Receives When Call The Assembly From Store Procedure To Create A Text File And To Write Text

Jun 21, 2006

Hi,
I want to create a text file and write to text it by calling its assembly from Stored Procedure. Full Detail is given below

I write a code in class to create a text file and write text in it.
1) I creat a class in Visual Basic.Net 2005, whose code is given below:
Imports System
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Diagnostics
Public Class WLog
Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
End Sub
Public Shared Sub LogIt(ByVal logMessage As String, ByVal wr As StreamWriter)
wr.Write(ControlChars.CrLf & "Log Entry:")
wr.WriteLine("(0) {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString())
wr.WriteLine(" :")
wr.WriteLine(" :{0}", logMessage)
wr.WriteLine("---------------------------")
wr.Flush()
End Sub
Public Shared Sub LotToEventLog(ByVal errorMessage As String)
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog
log.Source = "My Application"
log.WriteEntry(errorMessage)
End Sub
End Class

2) Make & register its assembly, in SQL Server 2005.
3)Create Stored Procedure as given below:

CREATE PROCEDURE dbo.SP_LogTextFile
(
@LogName nvarchar(255), @NewMessage nvarchar(255)
)
AS EXTERNAL NAME
[asmLog].[WriteLog.WLog].[LogToTextFile]

4) When i execute this stored procedure as
Execute SP_LogTextFile 'C:Test.txt','Message1'

5) Then i got the following error
Msg 6522, Level 16, State 1, Procedure SP_LogTextFile, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'SP_LogTextFile':
System.UnauthorizedAccessException: Access to the path 'C:Test.txt' is denied.
System.UnauthorizedAccessException:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, ileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.AppendText(String path)
at WriteLog.WLog.LogToTextFile(String LogName, String newMessage)

View 13 Replies View Related

How Can I Store A Text File Into SQL Server?

Apr 6, 2004

Hi,
Can some one give me some suggest?
Thanks!

View 2 Replies View Related

IS There A Way To Store List Of Errors In Text File

Apr 4, 2007

I want to attach a error list to my email task and i want my email task to send email only if there is an error...IS this possible..

View 8 Replies View Related

Importing Text File Store Procedure

May 27, 2008



hi guys..

i need some assistance.. i have couple of .txt file to import into database.. @ the moment i am doing by improting process in sql management.. but it's realy pain and time taking.. i got a stander file format that i import,. and the destination table if exist then ookay otherwise i just create one ..

Is it possible that i can write a Store procedure so that i can use that .... Please help me.. i dont' a single clue about this..


Thanks

View 1 Replies View Related

Store Blog Post Content In Text File Or Database?

May 21, 2006

    Hi. I am currently building a blog application, and I need some advice... I have the post title, post date, post by, etc stored in a database table, however I was wondering whether I should store the actual post content in the database as well or in a text file. For example, if the posts get really long would it slow down database performance or would there not be much of a difference? Furthermore, if I wanted to keep the posts private, a text file would not be ideal as it can be accessed easily by surfers... What do you recommend?Thanks a lot

View 1 Replies View Related

How To Store Large Chunks For Binary Data Into The DB?

Sep 7, 2006

From what I can see, the 'varbinary(max)' data type is not supported, and the 'image' data type is supposed to go away. Is there some other way to store large chunks (10MB to 100MB) of data into an SSEv DB?

If I have to use the 'image' data type to so this, does anyone have a code sample that would let me push an array() of numbers into an 'image' field, and unload an 'image' field into an array()?

TIA

Pat

View 7 Replies View Related

'String Or Binary Data Would Be Truncated' - Trying To Store URLs

Mar 15, 2007

I am an absolute beginner with SQL Server 2005 Express, and I want to make a new table in my database that stores web URLs and their Username and Password info. When I try to add a URL to the URL column, it says

Error Source: .Net SqlClient Data Provider

Error Message: String or binary data would be truncated.

The statement has been terminated.

I assume this means that the URL is too long to fit in the data type I specified, but I've tried almost every single data type there is, and I keep getting the same error. I was wondering if anyone knew what was wrong.

Thanks for any help.

View 3 Replies View Related

Converting Binary To Text

Jul 23, 2005

Hey,Another 'must be simple' question.. I'm wishing to convert a binaryfield into a textual representation of that binary data. i.e. come outwith what the query analyser would display, and not try to convert thebinary into ascii/whatever encoded text.Cheers for any clues,Chris

View 1 Replies View Related

Storing Text Data In A Binary Field

Jul 23, 2005

This may be a stupid question but I can't find an easy answer for what Iwant to do. I need a blob data field that can store both binary and textdata like the sql_variant field. I am using vb.net to populate a sql table.I want to store both string and binary data.

View 1 Replies View Related

Converting Binary Image To Readable Text

Sep 18, 2005

I have a table that contains the following two columns:BITS (image(16))BIT_LENGTH (int(4))When I look at the table, I see "OLE Object" in the BITS column. Whatsyntax should I use in a SELECT statement to convert the binary imageinfo contained in "BITS" into simple text that I can read? What roledoes the BIT_LENGTH field play?

View 1 Replies View Related

Binary File

Aug 5, 2004

Can someone firecct me to instructions on how to download a Binary file in a asp.net application.

I have a sql 2000 db that has a field that contains files and my users need access to them via my web app.

View 2 Replies View Related

Problem Importing Text Files With Binary Zeros (0x00) Via SSIS(SQL2005). It Is All Fine When Using DTS(SQL2000) Though.

Apr 24, 2008

Hi.

There is a "text" file generated by mainframe and it has to be uploaded to SQL Server. I've reproduced the situation with smaller sample. Let the file look like following:
A17 123.17 first row
BB29 493.19 second
ZZ3 18947.1 third row is longer
And in hex format:
00: 41 31 37 20 20 20 20 20 ”‚ 31 32 33 2E 31 37 20 20 A17 123.17
10: 66 69 72 73 74 20 72 6F ”‚ 77 0D 0A 42 42 32 39 20 first row™ͺ—™BB29
20: 20 00 20 34 39 33 2E 31 ”‚ 39 20 20 73 65 63 6F 6E 493.19 secon
30: 64 0D 0A 5A 5A 33 20 20 ”‚ 20 20 20 31 38 39 34 37 d™ͺ—™ZZ3 18947
40: 2E 31 20 74 68 69 72 64 ”‚ 20 72 6F 77 00 69 73 20 .1 third row is
50: 6C 6F 6E 67 65 72 ”‚ longer

I wrote "text" in quotes because sctrictly it is not pure text file - non-text binary zeros (0x00) happen sometimes instead of spaces (0x20).

The table is:

CREATE TABLE eng (


src varchar (512)

)

When i upload this file into SQL2000 using DTS or Import wizard, the table contains:

select src, substring(src,9,8), len(src) from eng
< src ><substr> <len>
A17 123.17 first row 123.17 25
BB29 493.19 22
ZZ3 18947.1 third row 18947.1 35

As one can see, everything was imported, including binary zeros. And though SELECT * in SSMS truncates strings upon reaching 0x00's, still all information is stored in tables - SUBSTRINGs show that.

When i upload this file into SQL2005 using SSIS or Import wizard the result is following:
< src ><substr> <len>
A17 123.17 first row 123.17 25
BB29 4
ZZ3 18947.1 third row 18947.1 25

This time table is half-empty - all characters behind binary zeros in respective rows are lost.

I stumbled upon this problem while migrating my DTSes to SSIS packages. Do you think there is some workaround, or i need to turn on some checkbox or smth else could help? Please...

View 8 Replies View Related

How To Read Binary File

Jun 6, 2007

Need help reading a binary file see below for details...
 
 I have uploaded a csv file into a sql table.
Now i want to extract the data and insert the data in the csv file into another sql table.
 What commands can i use in sql to extract/ read  the data ? 
 
 
 

View 7 Replies View Related

Write Binary From Sql To File In Vb.net

Mar 17, 2008

Hi,
 
I need help please.
 I have a image field in SQL called AttachData.
 I need to retrieve the information and save it on my computer.
I tried the following but it fails on the line 7.
How can I write the data from sql to my computer?
Here is my table in sql:
CREATE TABLE [dbo].[MailAttachment](
[MsgID] [int] NOT NULL,
[AttachName] [nvarchar](255) COLLATE Hebrew_CI_AS NULL,
[AttachType] [nvarchar](255) COLLATE Hebrew_CI_AS NULL,
[AttachSize] [int] NOT NULL DEFAULT (0),
[AttachCompSize] [int] NOT NULL DEFAULT (0),[AttachData] [image] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]1 Dim s As New _
2 System.IO.FileStream("c:emails" _
3 & "" & AttachName.ToString, System.IO.FileMode.CreateNew,System.IO.FileAccess.Write)
4
6
7 ' s.Write(CType(AttachData, Byte()), 0, CInt(AttachSize))
8
10
11 s.Close()
 

View 7 Replies View Related

Upload File To A DB In Binary

Apr 20, 2006

Hi have done the following but get the errors at the end, any ideas
 Created a stored procedureALTER PROCEDURE ulfile@upload varchar(200)ASINSERT INTO results(@upload)VALUES (@Upload)RETURN after sitting for two hours I realised I had a comma after (200) then the following in the .cs file using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class Default3 : System.Web.UI.Page{//PostedFile Property of Type HTTPPostedFileint intDocLen = txtFileContents.PostedFile.ContentLength;byte[] Docbuffer = new byte[intDoclen];protected void Page_Load(object sender, EventArgs e){ Stream objStream;//InputStream://Gets a Stream object which points to an uploaded Document; //to prepare for reading the contents of the file.objStream = txtFileContents.PostedFile.InputStream;objStream.Read(Docbuffer, 0, intDocLen);//results is the connection objectcmdUploadDoc = new SqlCommand("ulfile", results);cmdUploadDoc.CommandType = CommandType.StoredProcedure;//Add the Params which in the Stored Proc cmdUploadDoc.Parameters.Add("@upload ", SqlDbType.VarChar, 200);//Set Params ValuescmdUploadDoc.Parameters[0].Value = txtTitle.Text;//Set the "@Doc" Param to be Docbuffer byet ArraycmdUploadDoc.Parameters[1].Value = Docbuffer;cmdUploadDoc.Parameters[2].Value = strDocType; }private void btnSubmit_Click(object sender, System.EventArgs e){string strDocExt;//strDocType to store Document type which will be Stored in the Databasestring strDocType;//Will be used to determine Document lengthint intDocLen;//Stream object used for reading the contents of the Uploading DocumnetStream objStream;SqlConnection results;SqlCommand cmdUploadDoc;if(IsValid){if(txtFileContents.PostedFile != null){//Determine File TypestrDocExt = CString.Right(txtFileContents.PostedFile.FileName,4).ToLower();switch(strDocExt){case ".doc":strDocType = "doc";break;case ".ppt":strDocType = "ppt";break;case ".htm":strDocType = "htm";break;case ".html":strDocType = "htm";break;case ".jpg":strDocType = "jpg";break;case ".gif":strDocType = "gif";break;case ".im":strDocType = "im";break;default:strDocType = "txt";break;}//Grab the Content of the Uploaded DocumentintDocLen = txtFileContents.PostedFile.ContentLength;//buffer to hold Document Contentsbyte[] Docbuffer = new byte[intDocLen];//InputStream://Gets a Stream object which points to an uploaded Document; //to prepare for reading the contents of the file.objStream = txtFileContents.PostedFile.InputStream;//Store the Content of the Documnet in a buffer//This buffer will be stored in the DatabaseobjStream.Read(Docbuffer ,0,intDocLen);//Add Uploaded Documnet to Database as Binary//You have to change the connection stringBooksConn = new SqlConnection("Server=66.179.84.110;UID=******;PWD=******;Database=******");//Setting the SqlCommandcmdUploadDoc = new SqlCommand("ulfile",results);cmdUploadDoc.CommandType = CommandType.StoredProcedure;cmdUploadDoc.Parameters.Add("@upload ",SqlDbType.VarChar,200);cmdUploadDoc.Parameters[0].Value = txtTitle.Text;cmdUploadDoc.Parameters[1].Value = Docbuffer ;cmdUploadDoc.Parameters[2].Value = strDocType;Results.Open();cmdUploadDoc.ExecuteNonQuery();Results.Close();}//End of if(txtFileContents.PostedFile != null)}//End Of if(IsValid)}//End of Method btnSubmit_Click}  And the form code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"><title>Untitled Page</title></head><body><form id="frmUpload" method="post" enctype="multipart/form-data" runat="server"><span>Title</span><asp:textbox id="txtTitle" runat="server" EnableViewState="False"></asp:textbox><asp:requiredfieldvalidator id="valrTitle" runat="server" ErrorMessage="* Required" ControlToValidate="txtTitle">* Required</asp:requiredfieldvalidator><span>Document to Upload</span><input id="txtFileContents" type="file" runat="server" name="txtFileContents"></></><asp:button id="btnSubmit" Text="Submit" Runat="server" OnClick="btnSubmit_Click"></asp:button>   </form></body></html>  however when I try and view in browser I get the following Line 21:
Line 22:
Line 23: Stream objStream;
Line 24: //InputStream:
Line 25: //Gets a Stream object which points to an uploaded Document;  I have trawlled the net, MSDN and anywhere else I can find to see what it is and nothing. eventually changed  Stream.objstream to System.IO.Stream objStream; And now getting the following error Line 29:
Line 30: //results is the connection object
Line 31: cmdUploadDoc = new SqlCommand("ulfile",results);
Line 32: cmdUploadDoc.CommandType = CommandType.StoredProcedure;
Line 33: //Add the Params which in the Stored Proc  Can anyone help?

View 2 Replies View Related

Dtsconfig File Is Binary?

Feb 16, 2006

Hello all,

I'm trying to easily change a value in 80 ssis configuration files from "localhost" to "myservername". I downloaded WinGrep to do this, but it's balking on some of the files, saying that they are binary files.

Does anyone know how to make the *.dtsconfig files NOT binary in SSIS?

Any suggestions GREATLY appreciated.

I won't go into the reason I have my servername in 80 places...

Andy

View 6 Replies View Related

Import From Binary File

Feb 17, 2006

I am importing data from binary data files into SQL Server. This is the code I am using:

Do While Not EOF(1)
Get #1, , NonStdCurrRecord
adoRS.AddNew
adoRS!Field1 = CDate(NonStdCurrRecord.Field1)
adoRS!Field2 = CSng(NonStdCurrRecord.Field2)
adoRS!Field3 = CSng(NonStdCurrRecord.Field3)
adoRS!Field4 = CSng(NonStdCurrRecord.Field4)
adoRS!Field5 = CSng(NonStdCurrRecord.Field5)
adoRS!Field6 = CSng(NonStdCurrRecord.Field6)
adoRS!Field7 = CSng(NonStdCurrRecord.Field7)
adoRS.Update
Loop


Unfortunately, it takes about 8 mins to import a file with 180k records. Is there a faster way to do this?

View 4 Replies View Related

Length Of A Binary File In Sql Server

Jun 16, 2004

hello!
I am curious to know how I can find the length of a binary in Sql Server. The length doesn't work on binaries.
ie
select length(binary)
from Binarytable

View 2 Replies View Related

Bring File In As Binary Field

Apr 26, 2007

I want to have an SSIS package that processes a file in the normal insert, update style. But at the end I want to store the file as a binary field to another table for archive purposes. I am having trouble finding a good way to do this. Any samples, ideas, or articles would be appreciated.

View 8 Replies View Related

Retrive A File From A Binary Data Field

Nov 6, 2006

hello dear friends
I am trying to save a binary file to database with the following code:
public static void memorystreamToDb()
{
          MemoryStream mst = new MemoryStream();
          UnicodeEncoding u = new UnicodeEncoding();
          string Textn = "Test";
          byte[] b = u.GetBytes(Textn);
          mst.Write(b ,0,Textn.Length );
          BinaryReader reader = new BinaryReader(mst);
          byte[] file = reader.ReadBytes((int)mst.Length);
          using (SqlConnection connection = new SqlConnection("Some Connection String"))
          {
                    SqlCommand command = new SqlCommand("INSERT INTO temp (examplefile) Values(@File)", connection);
                    command.Parameters.Add("@File", SqlDbType.Binary, file.Length).Value = file;
                    connection.Open();
                    command.ExecuteNonQuery();
          }
          reader.Close();
          mst.Close();
}
or with the other method from a real file (not memory stream)
public static void Addfile(string path)
{
          CommonMethods_class k = new CommonMethods_class();
          byte[] file = GetFile(path);
          using (SqlConnection connection = new SqlConnection(k.Get_connection_string()))
          {
                    SqlCommand command = new SqlCommand("INSERT INTO temp (examplefile) Values(@File)", connection);
                    command.Parameters.Add("@File", SqlDbType.Binary, file.Length).Value = file;
                    connection.Open();
                    command.ExecuteNonQuery();
          }
}
and after running each of them seams that the file have been saved; but I can not retrive the files. I have tried some solutions from msdn but inside the created file is empty. the point that i really look for it is to just working with memory not in the disk before saving. and then retriving each field that I want.
looking forward your points
thank you in advance

View 2 Replies View Related

String Or Binary Data Would Be Truncated (from Xml File)

Apr 13, 2005

Hello all,
I am exporting data from AS/400 into an xml file and then importing the data from the xml file into an SQL database. I am getting the error: "The statement has been terminated. String or binary data would be truncated" when there are characters like "," or "&" in the xml. How can i solve this problem? Almost all my records have characters like that because they include comments and i can't disallow the users from entering these characters (especially ",").
Thanks,Mike.

View 1 Replies View Related

SQL 2012 :: Retrieve Binary File From Server

Apr 14, 2014

I have been trying to store binary file in a folder from the SQL Server.

Here is the code I am using to do this but, it is not working. It doesn't show any error only shows 1 row(s) affected. The folder remains empty after running this query.

I have already configured server using

EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE

SP_CONFIGURE 'Ole Automation Procedures', 1
GO
RECONFIGURE
GO
DECLARE @File VARBINARY(MAX),

[Code] .....

View 3 Replies View Related

Storing File As Binary Image Into SQL Server

Dec 21, 2005

I am using FileUpload control in ASP.net 2.0 to upload files and store them into SQL server database as an image. I am fine with MS office files, image files and etc. We have Product Center (Proe) engineering software to configure parts and the files generated through this software have PLT extension when I store these files, the file type is Plian/text. I am using Fileupload.PostedFile.Content to get the file type. How can I store PLT, TIF files in SQL server? Please help.

View 12 Replies View Related

Binary Column Or Flat File Best Practices?

Jul 17, 2007

I have a design oriented question for a system I am developing. Because of various business concerns and issues we have been moving towards as desing that brings files into the SQL 2005 system as binary columns in a database. These files will then be processed at a later time using SSIS into relation model tables.



Normally I would just have the process be files are placed on a FTP location (or other drive path) and a location is stored in the database versus the storing of them as binary rows in the database. Then later the SSIS package runs using the path information for the conneciton manager.



Based on the proposed binary design I have two questions.

1. Can anyone speak to the advantages, disadvantages, issues they have had, etc to the binary storage method?

2. Can anyone make a suggestion on how they would handle the pulling of the file out of SQL when the file is ready to process? Do you stream it to a file and rebuild it on the physical disk, to then just import it with a connection manager for the flat file structure.... or can you stream it directly into a conneciton manager that reads it like a flat file and parses the file without ever going to disk? Any information on suggested implementations would be helpful.



Thanks.

View 2 Replies View Related

Store Large Text

Feb 7, 2008



Hi,
To store large amount of text which datatype is best whether text or varchar(max).

Thnaks

View 1 Replies View Related

What Is The Best Way To Combine Two Text File Into One Text File In SSIS

Mar 20, 2008



Hi,

I am looking for a way to combine two text files into one file. I am thinking of using a batch file (DOS command ) to do it. Any suggestion please?

View 6 Replies View Related

SQL 2012 :: Max Size Of File Which Store To DB By File Stream

Dec 5, 2014

is there limitation for size of file to store in db by filestream in sql server 2008?or it accept all sizes?

View 1 Replies View Related

Store Xml Output In Text Format

Jun 4, 2008

I have the following Query which gives the output in XML format.
select * from <Table_Name> For XML auto
I wanted to store this output in a .Xml file at my local machine.
I would prefer to have a proc when called generates the xml and stores it on the local m/c. Any ideas ?
Thanks,

View 3 Replies View Related

How To Store Japanese Text In MS-SQL Server?

Oct 6, 2006

Dear All,

I am using JDK 1.5 with MS-SQL2000 as backend. I am try to store japanese text/charachters in the MS-SQL using jdbc. But whatever the japanese charaters are getting stored in MSSQL as ?????(which I think are corrupted-as read from internet.).
1. My problem is I want to store them exactly in the Japanese language formats(Kanji/or so).
2. In the same way when I am retriving it from database I am getting ???? only. Not the actual Japanese charaters which I have inserted.



P.N.: I am using:
mssqlserver.jar ---Driver DB connectivity

Can anyone suggest me the solution for the same?

Thanks in Advance,

Best Regards,

Niranjan
email: bnhsniranjan@gmail.com

View 1 Replies View Related

Writing Binary Data To Database Only To Refrence A File Location?

Sep 29, 2006

Hey everyone I've got this question that has me stuck for the last few days but its an important part of my website.....What I am trying to do is basicly have a user be able to upload a file, have that uploaded file plus some other info automaticly display on other parts of my site, and have a different user eventually be able to download that file....I have thought about allowing the file upload as a BLOB but still cannot find a proper way to execute this using VB, plus I have heard that this way of doing it is not reccommeneded cause databases were not designed to store large files like this, lots of articles recommened having the file upload to a Folder on your server then get the binary data for the file that can be placed in a database to refrence that particular file.....Well this also proves to be a lot harder then said here is what I got so far (written in C#) protected void UploadBtn_Click(object sender, EventArgs e)
{
if (FileUpLoad1.HasFile)
{

FileUpLoad1.SaveAs(@"C:Documents and SettingsAdamMy DocumentsVisual Studio 2005ProjectsWebsiteFiles" + FileUpLoad1.FileName);
Label1.Text = "File Uploaded: " + FileUpLoad1.FileName;
}
else
{
Label1.Text = "No File Uploaded.";
}
}
and here is the asp part of the code that goes with it<asp:FileUpLoad id="FileUpLoad1" runat="server" />

<asp:Button id="UploadBtn" Text="Upload File" OnClick="UploadBtn_Click" runat="server" Width="105px" />

<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
 Now from what I know is I need to get the binary of the file which I have read you can do with the Page.Request.Files statement but again not sure how I would impliment this.  Does anyone have any suggestions on which way I should take when dealing with this should I try and just use the BLOB method or use the binary refrence method? and if so how would I impliment this, heck even some good tutorials on the subject would be great... Thanks.....Adam

View 8 Replies View Related







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