Creating An Image Of A Server
Sep 24, 2007Hello,
any one --can you explain the meaning of 'Creating an Image of a server.'
Hello,
any one --can you explain the meaning of 'Creating an Image of a server.'
I am using an invoice image that is preset and a fixed size. I am trying to lay text boxes on top of this image, but the boxes move around differently when you preview and/or print preview. If this is deployed, then the form prints and all of the text box information prints after the invoice image. Has any one experienced this before?
And one more question, is there a way to make a report a fixed length in size, ie, another invoice that might have 1 line or 23 lines and the total always needs to print at the bottom of the report and not move up the page. Is there a way to fix your report to accomodate for that? I have tried list box, matrix, etc and I am unable to find a solution to this.
Any help with either of these questions would be greatly appreciated!!!
I am using the 3-tiered architecture design (presentation, business laws, and data acess layers). I am stuck on how to send the image the user selects in the upload file control to the BLL and then to the DAL because the DAL does all the inserts into the database. I would like to be able to check the file type in the BLL to make sure the file being uploaded is indeed a picture. Is there a way I can send the location of the file to the BLL, check the filetype, then upload the file and have the DAL insert the image into the database? I have seen examples where people use streams to upload the file directly from their presentation layer, but I would like to keep everything seperated in the three classes if possible. I also wasn't sure what variable type the image would be in the function in the BLL that receive the image from the PL. If there are any examples or tips anyone can give me that would be appreciated.
View 2 Replies View RelatedHay Friend's
Can u plese send me the way how to save image in sql server and display that images in datagrid or other control also like Image control or Image control Button?? Plese send the coding in C#.
Thank's
Amit
hi all,
i have created a table with image field in it. Now i just want to store a jpeg file in it but not finding any way to do so.
how can i store any image ? what are the steps???????
thanx in advance
Ok, the problem is that , i have a field called "Attach" in sql of type image, when selecting it , the field is getting data of type BYTE(). which am being unable to display them on an Image on the panel.
using the following vb.net code:
'Dim sel2 As String
'Dim myCom As SqlCommand
'Dim conn As New SqlConnection
'Dim drr As SqlDataReader
'Dim image As System.Drawing.Image
'sel2 = "select * from attach where att_desc = '" & DropDownList1.SelectedItem().Text & "' and doc_code = " & w_doc_code & " and subcode = " & w_doc_subcode & " and doc_num= " & w_doc_num & " "
'conn.ConnectionString = ("server=developer01;uid=sa;password=aims;database=DVPSOC;timeout=45")
'myCom = New SqlCommand(sel2, conn)
'conn.Open()
'drr = myCom.ExecuteReader()
'If drr.Read Then
' Me.ImageMap1.ImageUrl = drr.Item("attach")
'End If
'conn.Close()
Am getting an exeption on the following line Me.ImageMap1.ImageUrl = drr.Item("attach")
saying: Conversion from type 'Byte()' to type 'String' is not valid.
knowing that i tried converting using ToString but it's not getting any output then.
thanks for your help.
I have learned lots of informative thing from your forums. I have little problem regarding “Display image from SQL Server on ASP.NET� I have done it and image display on my page from SQL Server. I have cleared you here I have adopt two different methods which are following for displaying picture.
1.Response.BinaryWrite(rd("picture"))
2.image.Save(Response.OutputStream, ImageFormat.Jpeg)
but in both above methods I have faced little problem when image display on my page all other information can not display and I also want to display picture on my specific location on the page. My second question is can use any web control like “Image1� to display image from SQL Server where my pictures are stored.
Hope you will help me.
Thanks and regards
Aftab Abbasi
hi,i have inserted the image present in mydocuments using alter commandcreate table aa(a int, d image)insert into aa values (1,'F:prudhviaba 002.jpg')when i doselect * from aai am getting the result in the column d as0x463A5C707275646876695C70727564687669203030322E6A 7067how i can i view the image?pls clarify my doubtsatish
View 2 Replies View RelatedIn my asp.net application I have a local report with an image control in thedetail row of the table and the Value attribute set as="File://" & Fields!FQPhotoFileName.ValueThe first row in the table always shows the wrong image and it's always thesame wrong image. The problem is there even when I change the sort order orthe criteria for the underlying dataset. For example, I ran a small testthat populated the dataset with 2 rows and 2 images. When I sort by anycolumn (e.g. ID) in ascending ascending order the ID=1 row (the 1st row)shows the wrong image and the ID=2 row shows the correct image. When I rerunthe report sorting in descending order the ID=2 row (which is now the 1strow) shows the wrong image and the ID=1 shows the correct image.Any suggestions?
View 1 Replies View Related
Hi,
I have a website and i am uploading the gif image to the database. i have used varchar(500) as the datatype and i am saving the file in the webserver so the path to it c:intepub....a.gif
my upload table has the folliwing feilds
UploadId Int Identity, Description, FileName, DiskPath varchar(500), weblocation varchar(500). I have a main sproc for the report where i am doing a inner join with other table to get the path of the gif..
So my question is how can i get a picture to show up on the report. .
What kinda datatype the gif file should be stored in the database? If it is stored as a varchar how can i access it and what is best way to reference that particular.
any help will appreciated....
Regards
Karen
I have inherited a VS 2005 database with a table that has a column of type IMAGE. I need to change the image for one of the rows in the table. I have the new image in a *.PNG file on my C: drive. What is the correct method for inserting this file into the IMAGE column.
Many thanks!
Hi All,
I am manually replicating parts of a SQL Server CE database (running windows mobile 5.0) to a centralized SQL Server 2000 database.
My program is throwing an exception whenever I try to insert an image data type into the 2000 server from the PDA. I am using parameterized queries.
Error is as follows:
[error]
System.Data.SqlClient.SqlConnection.OnError()
at
System.Data.SqlClient.SqlInternalConnection.OnError()
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at
System.Data.SqlClient.TdsParser.Run()
at
System.Data.SqlClient.ExecuteReader()
at
System.Data.SqlClient.ExecuteNonQuery()
at
PDASync.Database.ExecuteIDRemote()
[/error]
The code for my ExecuteIDRemote method works fine for other queries. It also works if I remove the image column from the offending query.
Does anyone have any suggestions? Thanks.
Hello and thanks for taking a moment. I am trying to retrieve and display an image that is stored in SQL Server 2000. My aspx code is as follows:<HTML> <HEAD> <title>photoitem</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:DataGrid id="DataGrid3" HorizontalAlign='Left' runat="server" AutoGenerateColumns="true" Visible="True"> <Columns> <asp:TemplateColumn HeaderText="Image"> <ItemTemplate> <asp:Image Width="150" Height="125" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "InventoryItemPhoto")) %>' Runat=server /> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> </form> </body></HTML>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------My code behind file is below VS 2003 does not like my datareader. It says the following: 'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'Items'If there are any suggestions as to what I am doing wrong I would appreciate the input. - Jasonusing System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Data.SqlClient;using System.Text;namespace ActionLinkAdHoc{ /// <summary> /// Summary description for photoitem. /// </summary> public class photoitem : System.Web.UI.Page { string connStr = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; protected System.Web.UI.WebControls.DataGrid DataGrid3; private void Page_Load(object sender, System.EventArgs e) { // Get the querystring ID string item =Request.QueryString["ID"]; int ID=Convert.ToInt32(item); SqlConnection dbConn5 = new SqlConnection(connStr); SqlCommand sqlCom5 =new SqlCommand("sp4TWRetrieveItemPhotos"); sqlCom5.Connection = dbConn5; sqlCom5.CommandType = CommandType.StoredProcedure; sqlCom5.Parameters.Add("@ID", SqlDbType.Int); sqlCom5.Parameters["@ID"].Value =ID; dbConn5.Open(); SqlDataReader myDataReader; myDataReader = sqlCom5.ExecuteReader(CommandBehavior.CloseConnection); DataGrid3.DataSource = sqlCom5.ExecuteReader(); DataGrid3.DataBind(); while(myDataReader.Read()) { Response.ContentType = myDataReader.Items("JPEG"); Response.BinaryWrite(myDataReader.Items("InventoryItemPhoto")); } dbConn5.Close(); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion }}
View 1 Replies View RelatedHello and thanks for taking a moment. I am trying to retrieve and display an image that is stored in SQL Server 2000. My aspx code is as follows:<HTML> <HEAD> <title>photoitem</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:DataGrid id="DataGrid3" HorizontalAlign='Left' runat="server" AutoGenerateColumns="true" Visible="True"> <Columns> <asp:TemplateColumn HeaderText="Image"> <ItemTemplate> <asp:Image Width="150" Height="125" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "InventoryItemPhoto")) %>' Runat=server /> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> </form> </body></HTML>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------My code behind file is below VS 2003 does not like my datareader. It says the following: 'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'Items'If there are any suggestions as to what I am doing wrong I would appreciate the input. - Jasonusing System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Data.SqlClient;using System.Text;namespace ActionLinkAdHoc{ /// <summary> /// Summary description for photoitem. /// </summary> public class photoitem : System.Web.UI.Page { string connStr = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; protected System.Web.UI.WebControls.DataGrid DataGrid3; private void Page_Load(object sender, System.EventArgs e) { // Get the querystring ID string item =Request.QueryString["ID"]; int ID=Convert.ToInt32(item); SqlConnection dbConn5 = new SqlConnection(connStr); SqlCommand sqlCom5 =new SqlCommand("sp4TWRetrieveItemPhotos"); sqlCom5.Connection = dbConn5; sqlCom5.CommandType = CommandType.StoredProcedure; sqlCom5.Parameters.Add("@ID", SqlDbType.Int); sqlCom5.Parameters["@ID"].Value =ID; dbConn5.Open(); SqlDataReader myDataReader; myDataReader = sqlCom5.ExecuteReader(CommandBehavior.CloseConnection); DataGrid3.DataSource = sqlCom5.ExecuteReader(); DataGrid3.DataBind(); while(myDataReader.Read()) { Response.ContentType = myDataReader.Items("JPEG"); Response.BinaryWrite(myDataReader.Items("InventoryItemPhoto")); } dbConn5.Close(); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion }}
View 1 Replies View RelatedHi all,
I have a field in the SQL Server database, with 'Image' ad field type.
How can I add a jpeg fiel to it so that I can view it and also access it through a program?
Thanks
Tomy
Hi All,
I have to update image which is stored in Sql Server. How it is possible without deleting previous image using asp.net with Vb.net code.
Thanks in Advance
Regards,
Hello!
I want to read an image from the database. I've this function but she returns me an error that suggest me that the image might be damaged or corrupted.
I would like to know if it's possible and how to check an image in the DB.
Thank you!
When I am trying to save byte[] of an image to SQL server which is having an image column, I am getting an error like this " A severe error occured on the current command. The results, if any, should be discarded.". I am trying to save through a stored procedure.
In the sp also, the datatype is image.
Can you give a reply to this?
Hi,
Is it at all possible to have a default image in an image field in sql server?
If so how?
Thanks,
JB
help me;
i want to insert image into SQL server
Hi friends,
I am using ASP.NET (with C#) and SQL Server 2005 Express Edition.
I have to store images in database.
When I download the image from SQL, it gives exception 'Parameter is not valid.'
I check the size of the byte array and it is really not valid.
I store an image that has a size of 4991 bytes(as a byte array). But when I download it, it has only 13 bytes(byte array again).
This is my upload code :
MemoryStream ms = new MemoryStream();
System.Drawing.Image im = System.Drawing.Image.FromFile(Server.MapPath("Image\example.gif"));
Byte[] byteArray;
im.Save(ms, ImageFormat.Gif);
byteArray = ms.ToArray();
Here ms.Length is 4983 bytes not 4991! example.gif is 4991 bytes.
My SQL sentence :
"update reklamlar set Resim=" + byteArray + " where ReklamID=1;"
My download code :
byteArray = new byte[reader.GetBytes(4,0,null,0,int.MaxValue)];
mstream.Write(byteArray, 0, byteArray.Length);
System.Drawing.Image im = System.Drawing.Image.FromStream(mstream);
Here byteArray.Lenght is only 13!!!
Please help me what is wrong with this code?
Thanks a lot..
Note : In SQL management studio express, in the image area this text is written : <binary data>
It is 13 characters you see. May be there a relationship???
Hi! Guys,May be this question is little stupid but I want to clarify this.Let suppose I have image data field in Sql server 2000 and I am uploadingan image of 10KB(thru asp.net application).What would be the size for that table with image data field ?Is it 10KB or less than 10KB or more than 10KB ?ThanksJohnwww.e-classifiedad.com
View 2 Replies View RelatedHello,What's the best way to store files of an arbitrary size in a SQLServer / MSDE database? Some files will be text, but most should bebinary (images, audio, and video). I'd like to be able to store allthe files directly in the database so that backing everything up is asingle operation (I can do this, right?). Data retrieval speed is notoverly critical, as the code in question will be running on the samemachine as the database and will only have a single instance of theclient application. Any advice and/or hyperlinks to whitepapers on thesubject would be appreciated.Thanks,Will GantJoin Bytes!
View 2 Replies View Relatedhi i have a question about images in sql server. is it useful to store images in binary format in sql server or not. maybe this method is better than to sore images somewhere in the server, but i don't know mabe it uses more space or slows getting that images from sql server.
View 1 Replies View RelatedHello!
My real problem is that i want to read an image from an Sql Server DB, resize them and send them, all this through a Web Service. I decide to split my problem in four steps:
1 - read image from Database
2 - Resize that image
3 - Send her back to the DB
4 - Send the image throw a web service after he use a dataset to read the data from the DB.
i try to read the database with this function
Code Snippet
public System.Drawing.Image ReadImgFromDB(Int64 imageID)
{
System.Drawing.Image image = null;
using (SqlConnection conn = new SqlConnection())
{
string connString = WebConfigurationManager.ConnectionStrings
["StringCC"].ConnectionString;
conn.ConnectionString = connString;
SqlCommand myCommand = new SqlCommand(
"SELECT Pic FROM Images WHERE ID='"+ imageID +"'", conn);
conn.Open();
byte[] imageData = (byte[])myCommand.ExecuteScalar();
System.IO.MemoryStream memStream = new System.IO.MemoryStream(imageData);
image = System.Drawing.Image.FromStream(memStream);
}
return image;
}
i introduce a valid image ID and i get this message
--- " System.ArgumentException: Parameter is not valid.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.Image.FromStream(Stream stream)
at Service.ReadImgFromDB(Int64 chaveI) in e:Web ProjectsWSserviceApp_CodeService.cs:line 48"-----
line 48: "image = System.Drawing.Image.FromStream(memStream);"
Thank you!
HI,
Kindly Guide me how to store picture files in SQL server 2000 using Visual studio 2005
Hello Everyone I am trying to write image files to sql server using the following code. I have recieved the following error message
Failed to convert parameter value from a String to a Byte[]. Please help. I am sure it is a problem gathering the iostream. I am not very familiar. Any help is gretaly appreciated.
Thanks in advance
Here is the code:
'Dim User As MembershipUser = Membership.GetUser(CreateUserWizard1.UserName)
'Dim t As TextBox = DirectCast(FormView1.FindControl("aspnet_UserID"), TextBox)Dim objConn As SqlConnection
Dim objCom As SqlCommand
If Me.FileUpload1.HasFile Then
Dim fileExtension As String
Dim fileOK As Boolean = False
fileExtension = System.IO.Path. _
GetExtension(FileUpload1.FileName).ToLower()Dim allowedExtensions As String() = _
{".jpg", ".jpeg", ".png", ".gif", ".mwv"}For i As Integer = 0 To allowedExtensions.Length - 1
If fileExtension = allowedExtensions(i) Then
fileOK = True
End If
Next
'TryDim imagestream As System.IO.Stream = FileUpload1.FileContent
Dim data() As ByteReDim data(imagestream.Length - 1)
imagestream.Read(data, 0, imagestream.Length)
imagestream.Close()objConn = New SqlConnection(strNewConnection)
objCom = New SqlCommand("insert into ProfileImagesAndDocs(aspnet_userid,img_name,img_data,img_contenttype)values(@aspnet_userid,@imagename,@Picture,@CategoryName)", objConn)
'---------------------------------------------
'this is the aspnet_useridDim useridparameter As SqlParameter = New SqlParameter("@aspnet_userid", SqlDbType.VarChar)useridparameter.Value = Me.aspnet_userid.Text
objCom.Parameters.Add(useridparameter)
'---------------------------------------------
'This is the image name Dim imagenameparameter As SqlParameter = New SqlParameter("@imagename", SqlDbType.VarChar)imagenameparameter.Value = Me.FileUpload1.FileName
objCom.Parameters.Add(imagenameparameter)
'----------------------------------------------
'this is the picture dataDim pictureParameter As SqlParameter = New SqlParameter("@Picture", SqlDbType.Image)
pictureParameter.Value = data
objCom.Parameters.Add(pictureParameter)
'----------------------------------------------
'this is the profile area or category i.e. video introDim categorynameParameter As SqlParameter = New SqlParameter("@CategoryName", SqlDbType.VarChar)
pictureParameter.Value = "IntroVideo"
objCom.Parameters.Add(categorynameParameter)
objConn.Open()
objCom.ExecuteNonQuery()
objConn.Close()
'bookmark
Label1.Text = "File uploaded!"
'Catch ex As Exception
Label1.Text = "File could not be uploaded."
End If
Here is my task I am storing pdf's in sql server. I would like to retrieve the binary data from sql server and write the pdf content into an existing aspx page to the appropriate pageview section. What is the best way to handle this. The code works below but it loads a new browser with the content. I need it to appear in it's tabbed section in the original aspx file. Any assistance you can give me would be greatly appreciated.
Thanks Jerry
oSQLConn.Open()Dim myreader As SqlDataReader
myreader = myCommand.ExecuteReader
Response.Expires = 0
Response.Buffer = True
Response.Clear()
Do While (myreader.Read())
Response.ContentType = ("application/pdf")Response.BinaryWrite(myreader.Item("img_content"))
Loop
I am trying to store about millions of pictures in Web server with lots of traffic. some poeple told me. SQL server cannot handle it and may freeze quickly. can anybody tell me which way is better and more efficent? store image in SQL server image field or store in server's harddrive?
View 13 Replies View RelatedHi,
I have to store images in database. I have a table which contains field picture which is an image.
How can I do this using C# ?
In Visual Studio .NET i found a code how to obtain BLOB values from the database but I do not know how to do upload an image to the database.
Thanks in advance for your help.
Rafi
Is there method that an image file upload to sql server database? or transfer th link to database?
View 3 Replies View Relatedhi to all !!!!
i want to store the image file from user click in SQL Server , so how can i ??
How can i Store image (.jpg , .gif) in a database .
pls send me Code or any thing which helps me ...
Help!!
I need to store a few thousand images in a sql server database.
I've managed to write the asp code to retrieve images that are already in the pubs database, but haven't been able to find a satisfactory way of inserting new pictures in the first place.
At the moment we're using Notes and its great 'cos you just cut and paste them in. But now we need to take them all out and put them into sql server it's proving to be a nightmare. Any clues anyone??