Unable To Get The Content Of The Text File Saved In The Database(My-Sql)

Apr 4, 2011

In my MySql i am having my data field as longblob i would like to get the content in that file so i have written my code as follows

This is what i am doing before inserting

string filePath = Server.MapPath("AchTemplates/genACH.txt");
string filename = Path.GetFileName(filePath);
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
br.Close();
fs.Close();
string strQuery = "insert into tblFiles(FName,FData) values (@_FName, @_FData)";
MySqlCommand cmd = new MySqlCommand(strQuery);
cmd.Parameters.Add("@_FName", MySqlDbType.VarChar).Value = filename;
cmd.Parameters.Add("@_FData", MySqlDbType.LongBlob).Value = bytes;
InsertUpdateData(cmd);
//Get Data
private void download(DataTable dt)
{
Byte[] bytes = (Byte[])dt.Rows[0]["FData"];
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = dt.Rows[0]["ContentType"].ToString();
Response.AddHeader("content-disposition", "attachment;filename="
+ dt.Rows[0]["Name"].ToString());
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}

But i am getting the content as system.string[].

View 1 Replies


Similar Messages:

How To Read A Text File And Saved In Database

Nov 13, 2010

How to read a text file and saved in data base

View 1 Replies

Web Forms :: Finding The Required Text From The Saved Text File

Jun 25, 2010

i have saved a text file with a name batchheader.txt.

View 3 Replies

Forms Data Controls :: Data Unable To Be Saved In Database When Placed In A Table

Feb 13, 2011

I got a table in a formview where i placed lots of textboxes and dropdownlists inside the table because I need these textboxes and dropdownlists on a background image.

the data on textboxes and dropdownlists that are inside the table is unable to be saved into the database when i pressed the "submit" button. Other textboxes and dropdownlists that are not inside the table work fine. Here are the HTML code for the table:

<asp:Table ID="Table1" runat="server" BackImageUrl="~/images/DRAWING.jpg">

View 9 Replies

Data Controls :: Delete File Saved In Database Using GridView

Feb 26, 2014

When I am creating a new form, I am inserting "RequestId" of particular form in Textbox as well as uploading multiple file (that comes in Gridview)and on save button click, those gridview multiple files with "RequestId" are saved in Database as below:

Id Request Id File Name

1 12 Abc.jpg
2 12 Xyz.doc
3 12 Pqr.png
4 11 Abc.xls
5 11 aa.jpg

NOTE: Auto increment of "Id" is true.

Now, I want that If I delete any file from the Gridview(which has all uploaded files), I want that file to be deleted from database table also.Currently on Deleting file from Gridview, files from "Folder" are deleted not from Database.

View 1 Replies

Data Controls :: How To Modify File Saved In Database Using GridView Control

Jan 12, 2014

Based on the the following article:

Upload and Download files from SQL Server Database in ASP.Net

View 1 Replies

SQL Server :: Unable To Restore Database Backup File In Database ?

Aug 31, 2010

i am trying to restore database.bak in sql server 2005 (i know the database.bak was also generated in sql 2005 server)

i am trying to restore back up database .bak into the new database i just created in sql server 2005i have saved my database .bak into c drive and when i select database .bak "From Device", it doesn't get populated in the list below and i see nothing and it keeps on prompting a message"You must select a restore source"

Here's the screen shot: (i tried restoring database in sql server 2008 and it was sucessful but i am facing this problem in sql server 2005 only)

View 4 Replies

Web Forms :: Reading Information Content From A Saved Image?

Mar 15, 2011

how to read content information from a saved image in SQL image column. I do not want to read the image and display it I know how to do that, what I am trying to accomplish is read the content of that images already saved in the SQL image field, for instance I have a saved image (.JPG, .GIF, PNG, BMP etc) that contains customer demographic information such as (name,address,phone etc) and also contains sensitive data such as (SSN, DOB etc) I just want to retrieve the demographic information and display it on the screen leaving out the sensitive data.

View 1 Replies

How To Insert Update A Text File Content In C#

Feb 27, 2010

I need to insert and edit a textfile content in C#. How to find the line number of the text file.

View 5 Replies

Data Controls :: Display Already Stored Text Content From Database

Mar 5, 2013

i want to display already stored text content (sql server)  into asp.net webpage at table format

Now  i want to display at table.. alternatively, i want table for gridview. already view at this format. it is gridview..

QaIdQueryAnswer

7
the captain of indian cricket team Mahendra Singh Dhoni
Mahendra Singh Dhoni, commonly known as M. S. Dhoni, is an Indian cricketer and the current captain of the Indian national cricket team and the Chennai Super Kings cricket team. Born: July 7, 1981 (age 31), Ranchi Height: 1.75 m Spouse: Sakshi Dhoni (m. 2010) Salary: 3.5 million USD (2012) Education: DAV Jawahar Vidya Mandir, Shyamali Parents: Pan singh, devki devi.

View 1 Replies

Unable To Open A Text File In Browser Window

Feb 25, 2011

i have an aspx page that loads and displays a text file in a broswer window and it used to work, I made no changes to it and now testing shows additional content appended below the file.

Here is the text file:

testing...

Here is what is displayed:

[Code]....

The additional output looks like the aspx page itself, which has only a close button incase the file load fails.

Here is the apsx page:

[Code]....

Here is the code:

[code]....

View 1 Replies

Web Forms :: Upload A Text File And Display The Content In A Grid View?

Nov 25, 2010

I am trying to upload a text file and display the content in a grid view. However, when i try to upload it,it appear this error? Oh ya, do you know the code to upload text file? If you know can u edit my code to make it take the file from fileupload instead of textbox?

The error is:

Index was outside the bounds of the array. 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.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:

[Code]....

View 5 Replies

C# - Page Content In Database Vs File Performance?

Sep 29, 2010

I am creating a site whose content is dynamic and has images in it.How much performance hit will my DB (MSSQL) take if I save content/Images in DB?

View 3 Replies

C# - Refer The Resultant Xml File Which Is Being Constructed And Saved From Webservice File

Sep 6, 2010

This is my webservice code which performs constructs xml file and stores to particular destination ,Is this the correct way to store the resultant xml file ,or let me know if their are any alternate procedure to do so.

[WebService(Namespace = "[URL]")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class JsonWebService : System.Web.Services.WebService
{
XmlDocument xmlDoc = new XmlDocument();
public string keyword;
public JsonWebService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public bool GetList(string keyword1, string streetname, string lat, string lng, string radius)
{
XmlDocument xmlDoc= CreateXML( keyword1,streetname,lat,lng,radius);
//save file to application folder which will be refferd by client application
xmlDoc.Save(@"C:Documents and SettingsDesktop lockBlock3.xml");
return true;
}

I am not able to refer that xml file constructed at webservice ,from clientside applicaton this will be my code on clientside ,is this the right way to refer saved xml file

function searchLocationsNear() {var searchUrl ="[URL]"; //reference for xml file stored in application folder
GDownloadUrl(searchUrl, function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName('marker');
map.clearOverlays();
..........................

View 1 Replies

C# - Importing A Text File Database In Sql Server Database In C#?

Jan 22, 2010

am importing a text file database in my sql server database in asp.net c#.but i cannot fetch the column name from .txt file which contains a numeric data now what to do?

View 1 Replies

Databases :: Unable To Import Database File Into MSSQL Using 'My Little Admin'?

Sep 13, 2010

I am pretty good with HTML, PHP & MYSQL but this is my first go at working with a windows host and an ASP script. I recently purchased a script that matches my clients needs and when i have opened the folder to view the files its all double dutch to me apart from one css files which makes perfect sense to me!

Im stuck with is the database file included in the template, i ave been unable to import it into MSSQL using 'My Little Admin' which is the control panel provided by my hosting provider. Looking through the file with notepad it seems to contain the information for several tables but i cannot figure out for the life of me how i import it with 'My Little Admin'

View 3 Replies

Forms Data Controls :: Storing Uploaded File Content Into Database?

Dec 15, 2010

I am working on the application that allows user to upload a file (from their local machine) and store the uploaded file in database.Then,the content of the file (such as ContentType,FileSize etc)can be view in a DetailsView control.

View 1 Replies

ADO.NET :: Tab Characters Not Saved To Database?

Feb 26, 2011

I have a text field into which I'm saving order details, using LINQ to SQL.

Each order may have a different number of columns, depending on the type of order, so I thought I'd just create a single structure to take care of everything, and display details in tab delimited columns.

The text is created properly prior to saving to database:

[Code]....

However, when stored in the database, the spacing is no longer maintained.

[Code]....

View 6 Replies

How To Retrieve The Image Which Are Saved In Database

Mar 5, 2010

I write the following code but there is an error. I just want to retrive the image which I have save into tha database from the sql server and to display in the picture Box(image)

[Code]....

View 3 Replies

MVC :: First Value Of Dropdown List Is Saved To Database?

May 3, 2010

In the following code i want to save the value selected by user from drop downlist into database. but whatever value is selected by user, first value is saved to database

[Code]....

View 1 Replies

MVC :: On Submit Watermarks Are Saved In Database?

Oct 4, 2010

used Ajax.BeginForm for form submitting.For the fields I want to show watermark if there is no data in database.But on submitting watermarks are saved in database.

View 6 Replies

AJAX :: ReorderList Can't Be Saved To Database?

Jan 16, 2010

I followed the following linkhttp://weblogs.asp.net/justinsaraceno/archive/2008/02/22/reorderlist-with-objectdatasource.aspxand manged to make the orderlist work fine except one thing and probably the most importent thingwhich is saving the reorder back to the databasewhat I changedfirst I'm using it as a c# web form inside a visual basic.net website. Is this OK?second I changed the connectionString to point to my database wich is in SQLEXPRESS ( NOT ATTACHED in App_Data inside the website as the example shows)third I changed the select and update statements and parameters to my needsafter all that it works but without saving the reorder back to databaseReorderClass.cs

[Code]....

View 2 Replies

Value Is Saved In Database But Is Not Showing In Dropdownlist

Apr 26, 2015

I am currently learning vb.net with sql. I have two textboxes (txtValue and txtText) , a dropdownlist (ddl1) and save button (btnAdd). I insert value to txtValue and txtText (eg: txtValue: A and txtText: Apple). When I click button Add, The value will display in dropdownlist (like this; A - Apple) and both data will be save in the sqlserver (db).

I am having issue where when i click button Add, the data is not display in the dropdownlist. But when i refresh my browser, the data will display in dropdownlist.

ASP.net

Code:
<asp:DropDownList ID="ddl1" runat="server" CssClass="form-control" AutoPostBack="true"></asp:DropDownList>
<label class="form-control-static">Value</label>
<asp:TextBox ID="txtValue" runat="server" CssClass="form-control"></asp:TextBox>
<label class="form-control-static">Text</label>
<asp:TextBox ID="txtText" runat="server" CssClass="form-control"></asp:TextBox>
<button id="btnAdd" runat="server" style="min-width: 80px;">Add</button>

VB.Net

Code:

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Page.IsPostBack = False Then
Dim rs As DataSet
ddl1.Items.Clear()
ddl1.Items.Add("")

[Code] .....

View 1 Replies

Web Forms :: Getting Name Of Saved File?

May 10, 2010

When saving a file using vb.net:

file.SaveAs("c:/xx/xx/xx/xx/xx/" & file.FileName)

If a file is saved that already exists, is there a way to capture the saved filename?

View 1 Replies

Progress Bar Till The Data Is Not Saved In The Database?

Jan 25, 2011

have a button called "Confirm" which updates the datas entered in the screen. But the procress takes 1-2 minutes to update. I want to add a progress bar which automatically appears when the "confirm " button is clicked and automatically closes once the update is done.

View 19 Replies







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