Search Results

Search found 451 results on 19 pages for 'filestream'.

Page 2/19 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to backup/restore excluding filestream varbinary in SQL Server 2008?

    - by fdierre
    There is an application used in a production site that uses SQL Server 2008 as its DBMS. The database schema uses Filestream Varbinary to save binary data on the filesystem instead of directly into the DB tables. The point is that now and then it would be useful to copy the production database on development machines, mostly for doing troubleshooting. The database is too big for comfortably moving it around, but it would be ok if it could be moved leaving out the filestream varbinary fields. In other words, I am trying to make an "imperfect" copy of a database: i.e., on the destination database, it is ok to have NULL values instead of the varbinary. Is this possible? I tried looking for the feature on the SQL Server Management studio and did a backup that excludes the filegroup containing the filestream varbinary, but I cannot restore: MSSMS complains that the restore cannot be done because the backup is incomplete (of course). Is it possible to achieve what I am trying to do in some way?

    Read the article

  • How come the Name property is <Unknown> on a FileStream which uses handle constructors?

    - by Mikael Svenson
    Say you get a file handle from some outside DLL and instantiate a FileStream with it. It works just fine for reading and writing. Then you want the path and name of that handle and try to access the Name property of your FileStream object, and it returns 'unknown'. This is true for the constructors which takes file handles: public FileStream(IntPtr handle, ... public FileStream(SafeFileHandle handle, ... I know the short answer, because it's not implemented. The private field _fileName of FileStream is never assigned in those constructors. Seems the API to get the name from a handle involves more than one line of code, but I still think they could have bothered to include this. So the real questions is: Why haven't they? Or did they just forget?

    Read the article

  • How do I set the UNC permissions on a SQL Server 2008 Filestream UNC?

    - by Justin Dearing
    I have a SQL Server 2008 instance. I have configured filestream access properly, and use it from one column on one table in one of my databases. However, I cannot access the UNC share for the filestream data. I have tried browsing to it as well as trying to open specific files and I get errors both ways. I am running SQL Server 2008 enterprise on a Windows 7 workstation running on the domain. I've tried running the sql server service as a local user, then as network admin. The user I am logged in as is a local admin and a sysadmin in SQL server.

    Read the article

  • FileStream and FileTable in SQL Server 2012

    SQL Server 2012 enhanced the SQL Server 2008 FileStream data type by introducing FileTable, which lets an application integrate its storage and data management components to allow non-transactional access, and provide integrated SQL Server services. Arshad Ali explains how. Top 5 hard-earned lessons of a DBAIn part one, read about ‘The Case of the Missing Index’ and learn from the experience of The DBA Team. Read now.

    Read the article

  • Is there an alternative of using a VBScript for enabling FileStream after SQL Server installation?

    - by user193655
    To use Filestream on a DB 3 steps must be done: 1) enable it a server/instance level 2) enable it (sp_configure) at DB level 3) create a varbinary(max) field that supports filestream (2) and (3) are done easily with T-SQL (1) is doable manually from SQL Server Configuration Manager, basically what I need is to check all the 3 checkboxes: but how is it possible to automize it? I found this artcile "Enabling filestream usin a VBScript", is there another way to do it than using VBScripts? May be something that is possible to do only with 2008R2? In case it VBScript is the only solution, which are the possible downsides?

    Read the article

  • FileStream to save file then immediately unlock in .NET ?

    - by aron
    I have this code that saves a pdf file. FileStream fs = new FileStream(SaveLocation, FileMode.Create); fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); fs.Flush(); fs.Close(); It works fine. However sometimes it does not release the lock right away and that causes file locking exceptions with functions run after this one run. Is there a ideal way to release the file lock right after the fs.Close()

    Read the article

  • FileStream to save file then immediately unlock in C# ?

    - by aron
    Hello, I have this code that saves a pdf file. FileStream fs = new FileStream(SaveLocation, FileMode.Create); fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); fs.Flush(); fs.Close(); It works fine. However sometimes it does not release the lock right away and that causes file locking exceptions with functions run after this one run. Is there a ideal way to release the file lock right after the fs.Close() thanks!

    Read the article

  • How to read Hebrew text using System.IO.FileStream?

    - by Jonathan Dyle
    Hi all Am I missing something or does System.IO.FileStream not read Unicode text files containing Hebrew? public TextReader CSVReader(Stream s, Encoding enc) { this.stream = s; if (!s.CanRead) { throw new CSVReaderException("Could not read the given CSV stream!"); } reader = (enc != null) ? new StreamReader(s, enc) : new StreamReader(s); } Thanks Jonathan

    Read the article

  • Does binarywriter.flush() also flush the underlying filestream object?

    - by jacob sebastian
    I have got a code snippet as follows: Dim fstream = new filestream(some file here) dim bwriter = new binarywriter(fstream) while not end of file read from source file bwriter.write() bwriter.flush() end while The question I have is the following. When I call bwriter.flush() does it also flush the fstream object? Or should I have to explicitly call fstream.flush() such as given in the following example: while not end of file read from source file bwriter.write() bwriter.flush() fstream.flush() end while A few people suggested that I need to call fstream.flush() explicitly to make sure that the data is written to the disk (or the device). However, my testing shows that the data is written to the disk as soon as I call flush() method on the bwriter object. Can some one confirm this?

    Read the article

  • Open C: Directly with `FileStream` without `CreateFile` API

    - by DxCK
    I trying to open C: directly with FileStream without success: new FileStream("C:", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); System.UnauthorizedAccessException was unhandled Message="Access to the path 'C:\' is denied." Source="mscorlib" StackTrace: in System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) in 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) in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) in ReadingMftNewTest.Program.Main(String[] args) in D:\CS\2008\ReadingMftNewTest\ReadingMftNewTest\Program.cs:line 76 Note that i openning "C:" but the error says "C:\", where did this slash came from? :\ Is there any chance to open C: without using the CreateFile API? I really don't want be depending on WIN32 API because this code should also run on Mono that dont support WIN32 API, but successfully openning devices with regular FileStream (Mono 1 Microsoft 0).

    Read the article

  • C# Silverlight - XmlDictionary from Uri

    - by Robert White
    I've been developing a Silverlight application for a company's website and have encountered a problem. Up until now I have been programming this locally, now I need to publish the program onto the website; the issue is that FileStream can only access local files with elevated permissions. Here's a snippet of code: using (FileStream fileStream = new FileStream(@"E:\Users\LUPUS\Documents\Visual Studio 2010\Projects\Lycaon5\Lycaon5\acids.xdb", FileMode.Open)) { using (XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(fileStream, XmlDictionaryReaderQuotas.Max)) { //Read the XML file out. } } Without changing anything to do with XmlDictionaryReader reader - How could I go about reading the files from a relative Uri? Many Thanks, Rob. P.s. Apologies for the lack of formatting, me cave man, me don't know how.

    Read the article

  • C#: String.IndexOf to FileStream.Seek

    - by pistacchio
    Hi, having a FileStream that I read with a StreamReader (it is a very large file), how can I set the Seek position of the FileStream to the first occurrence of a certain substring so that I can start reading this large file from a given point? Thanks

    Read the article

  • SQL SERVER – Working with FileTables in SQL Server 2012 – Part 2 – Methods to Insert Data Into Table

    - by pinaldave
    Read Part 1 Working with FileTables in SQL Server 2012 – Part 1 – Setting Up Environment In this second part of the series, we will see how we can insert the files into the FileTables. There are two methods to insert the data into FileTables: Method 1: Copy Paste data into the FileTables folder First, find the folder where FileTable will be storing the files. Go to Databases >> Newly Created Database (FileTableDB) >> Expand Tables. Here you will see a new folder which says “FileTables”. When expanded, it gives the name of the newly created “FileTableTb”. Right click on the newly created table, and click on “Explore FileTable Directory”. This will open up the folder where the FileTable data will be stored. When clicked on the option it will open up following folder in my local machine where the FileTable data will be stored. \\127.0.0.1\mssqlserver\FileTableDB\FileTableTb_Dir You can just copy your document just there. I copied few word document there and ran select statement to see the result. USE [FileTableDB] GO SELECT * FROM FileTableTb GO SELECT * returns all the rows. Here is SELECT statement which has only few columns selected from FileTable. SELECT [name] ,[file_type] ,CAST([file_stream] AS VARCHAR) FileContent ,[cached_file_size] ,[creation_time] ,[last_write_time] ,[last_access_time] FROM [dbo].[FileTableTb] GO I believe this is the simplest method to populate FileTable, because you just have to move the files to the specific table. Method 2: T-SQL Insert Statement There are always cases when you might want to programmatically insert the images into SQL Server File table. Here is a quick method which you can use to insert the data in the file table. I have inserted a very small text file using T-SQL, and later on, reading that using SELECT statement demonstrated in method 1 above. INSERT INTO [dbo].[FileTableTb] ([name],[file_stream]) SELECT 'NewFile.txt', * FROM OPENROWSET(BULK N'd:\NewFile.txt', SINGLE_BLOB) AS FileData GO The above T-SQL statement will copy the NewFile.txt to new location. When you run SELECT statement, it will retrieve the file and list in the resultset. Additionally, it returns the content in the SELECT statement as well. I think it is a pretty interesting way to insert the data into the FileTable. SELECT [name] ,[file_type] ,CAST([file_stream] AS VARCHAR) FileContent ,[cached_file_size] ,[creation_time] ,[last_write_time] ,[last_access_time] FROM [dbo].[FileTableTb] GO There are more to FileTable and we will see those in my future blog posts. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: Filestream

    Read the article

  • Are non-modified FILESTREAM files excluded from DIFFERENTIAL backups?

    - by TiborKaraszi
    Short answer seems to be "yes". I got this from a forum post today, so I thought I'd test it out. Basically, the discussion is whether we can somehow cut down backup sizes for filestream data (assumption is that filestream data isn't modified very frequently). I've seen this a few times now, and often suggestions arises to somehow exclude the filestream data and fo file level backup of those files. But that would more or less leaves us with the problem of the "old" solution: potential inconsistency....(read more)

    Read the article

  • Flex 3 / Air: Writing blank new lines to files using FileStream

    - by Edward
    I want to write some text directly to a file using Flex 3 / Air. The text on the file (call it "Database.txt") must have the following format: Line1 Line2 Line3 var FS:FileStream = new FileStream(); var DatabaseFile:File = File.desktopDirectory.resolvePath("Database.txt"); FS.open(DatabaseFile, FileMode.WRITE); FS.writeUTFBytes("Line1" + "\n" + "Line2" + "\n" + "Line3"); FS.close(); But it writes the following text to the file: Line1 Line2 Line3. I'm pretty sure I'm making a very dummy error, but I cannot figure out what it is. Can anyone help me? Thank you for your time :)

    Read the article

  • Q on filestream and streamreader unicode

    - by habbo95
    HI all of u,, I have big problem until now no body helped me. firstly I want to open XXX.vmg (this extension come from Nokia PC Suite) file and read it then write it in richtextbox. I wrote the code there is no error and also there is no reault in the richtextbox here is my code FileStream file = new FileStream("c:\\XXX.vmg", FileMode.OpenOrCreate, FileAccess.Read); StreamWriter sw = new StreamWriter(fileW); StreamReader sr = new StreamReader(file); string s1 = sr.ReadToEnd(); string[] words = s1.Split(' '); for (int i=0; i<words.length; i++) richTextBox1.Text +=Envirment.NewLine + words[i]; The output at richtextbox just blank line

    Read the article

  • how to read the txt file from the database(line by line)

    - by Ranjana
    i have stored the txt file to sql server database . i need to read the txt file line by line to get the content in it. my code : DataTable dtDeleteFolderFile = new DataTable(); dtDeleteFolderFile = objutility.GetData("GetTxtFileonFileName", new object[] { ddlSelectFile.SelectedItem.Text }).Tables[0]; foreach (DataRow dr in dtDeleteFolderFile.Rows) { name = dr["FileName"].ToString(); records = Convert.ToInt32(dr["NoOfRecords"].ToString()); bytes = (Byte[])dr["Data"]; } FileStream readfile = new FileStream(Server.MapPath("txtfiles/" + name), FileMode.Open); StreamReader streamreader = new StreamReader(readfile); string line = ""; line = streamreader.ReadLine(); but here i have used the FileStream to read from the Particular path. but i have saved the txt file in byt format into my Database. how to read the txt file using the byte[] value to get the txt file content, instead of using the Path value.

    Read the article

  • Telerik RadEditor filestream/string save to RTF

    - by hoombar
    Hi, The required functionality I am aiming for is to pull out RTF content from a database, edit it through a web interface (with a WYSIWYG editor) and then place the modified text back in to the database (in RTF format). The control that I am using to do this is Telerik RadEditor (we have a license already for these controls). In the most recent version there appears to be functionality to load in RTF content from a string or a stream, but the only method I can see that is exposed for getting RTF back out is exportToRTF(); this method modified the headers and allows you to save a RTF version of the content you have just edited as a file. The functionality to convert from HTML to RTF must exist somewhere within their library as you can export a RTF file, but I can not find any publicly exposed methods to pass this in to a stream or a string. Does anybody know of a way that I can convert the HTML back to RTF using the Telerik libraries without saving out to a file? Thanks

    Read the article

  • Read file from root directory folder using filestream

    - by SurajSing
    There are two Image files in my folder which I have to call in my program. I have used: AppDomain.curentDomain.baseDirectory + "Path and file name"; But this goes into my bin directory which I don't want; I want to read the folder from root directory where my folder name as resource I have saved my file there and call the image so please what's the code for that? How do I read from root directory in a Windows Form Application?

    Read the article

  • C# "Could not find a part of the path" - Creating Local File

    - by Pyronaut
    I am trying to write to a folder that is located on my C:\ drive. I keep getting the error of : Could not find a part of the path .. etc My filepath looks basically like this : C:\WebRoot\ManagedFiles\folder\thumbs\5c27a312-343e-4bdf-b294-0d599330c42d\Image\lighthouse.jpg And I am writing to it like so : using (MemoryStream memoryStream = new MemoryStream()) { thumbImage.Save(memoryStream, ImageFormat.Jpeg); using (FileStream diskCacheStream = new FileStream(cachePath, FileMode.CreateNew)) { memoryStream.WriteTo(diskCacheStream); } memoryStream.WriteTo(context.Response.OutputStream); } Don't worry too much about the memory stream. It is just outputting it (After I save it). Since I am creating a file, I am a bit perplexed as to why it cannot find the file (Shouldn't it just write to where I tell it to, regardless?). The strange thing is, It has no issue when I'm testing it above using File.Exists. Obviously that is returning false, But it means that atleast my Filepath is semi legit. Any help is much appreciated.

    Read the article

  • creating a file from input stream

    - by daemonkid
    My component will receive a pdf file as a filestream from which I will need to create a file. For testing purposes I am trying to read a file using the filestream object and recreate it at a different location. But the recreated file is created blank. the recreated file has the same number of pages though... This is the code StreamReader sr = new StreamReader(_filePath); str = sr.ReadToEnd(); File.WriteAllText(@"C:\recreated.pdf", str); what am I doing wrong?

    Read the article

  • XmlSerializer.Serialize doesn't save a file and doesn't throw an exception.

    - by Wodzu
    Hi guys. I am having problem with saving of my object. Take a look at this code: public void SerializeToXML(String FileName) { XmlSerializer fSerializer = new XmlSerializer(typeof(Configuration)); using (Stream fStream = new FileStream(FileName, FileMode.Create, FileAccess.Write, FileShare.None)) { fSerializer.Serialize(fStream, this); } } The problem is that when the user does not have rights to the location on hard disk, this function will not throw me any exception and do not save my file. For example saving to "C:\test.xml" act like nothing happened. And I would like to know if the file has not been saved and it would be good to know the reason why. I know that I could check if the file on given location exists and throw an exception manualy but shouldn't this be done by the XmlSerializer or FileStream itself? Thanks for your time

    Read the article

  • c# creating a file from input stream

    - by daemonkid
    My component will recieve a pdf file as a filestream from which I will need to create a file. For testing purposes I am trying to read a file using the filestream object and recreate it at a different location. But the recreated file is created blank. the recreated file has the same number of pages though... This is the code StreamReader sr = new StreamReader(_filePath); str = sr.ReadToEnd(); File.WriteAllText(@"C:\recreated.pdf", str); what am I doing wrong? Thanks for your time.

    Read the article

  • how to send binary data within an xml string

    - by daemonkid
    I want to send a binary file to .net c# component in the following xml format <BinaryFileString fileType='pdf'> <!--binary file data string here--> </BinaryFileString> In the component that is called I will use the above xml string and convert the binary string recieved within the BinaryFileString tag, into a file as specified by the filetype='' attribute. The file type could be doc/pdf/xls/rtf I have the code in the calling application to get out the bytes from the file to be sent. How do I prepare it to be sent with xml tags wrapped around it? I want the application to send out a string to the component and not a byte stream. This is because there is no way I can decipher the file type [pdf/doc/xls] by just looking at the byte stream. Hence the xml string with the filetype attribute. Any ideas on this? method for extracting Bytes below FileStream fs = new FileStream(_filePath, FileMode.Open, FileAccess.Read); using (Stream input = fs) { byte[] buffer = new byte[8192]; int bytesRead; while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) { } } return buffer; Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >