Updating Image In SQL Server 6.5 Using Powerbuilder 4

Jul 5, 1998

How do I update and retrieve data which is of type image into/from SQL Server database in Powerbuilder 4.0.06 scripts? I`ve tried using SELECTBLOB and UPDATEBLOB, but it doesn`t work. I wanted to use WRITETEXT, UPDATETEXT and READTEXT in stored procedure, but SQL Server doesn`t allow datatype image to be passed in as a parameter. I also tried using the WRITETEXT directly in Powerbuilder scripts as follows:
WRITETEXT tablename.colname :ptr :graphics;

where ptr and graphics are local variables in PB scripts. ptr is supposed to be of type varbinary in SQL Server syntax. However, there is no equivalent datatype in PB. graphics is of type BLOB in PB scripts which is equivalent to image in SQL Server syntax.

Please advise. Thank you.

View 1 Replies


ADVERTISEMENT

Updating The Image Field In SQL Server Via DataSet

Aug 22, 2006

Hello,I am trying to update the Image type field named as BlobData in sqlServer 2000. I capture the record in a data set to have the schema and try to update the BlobData field of type Image by assigning it a value of buffer as below. but my assignment seems to be wrong and generates an error saying Object reference not set.
Code=========================
Dim fileBuffer(contentLength) As Byte
 
Dim attachmentFile As HttpPostedFile = Me.fileUpload_fu.PostedFile
 
attachmentFile.InputStream.Read(fileBuffer, 0, contentLength)
 
Dim cn As SqlClient.SqlConnection
 
Try
      Dim sSQL As String
      Dim cmd As SqlClient.SqlCommand
      Dim da As SqlClient.SqlDataAdapter
      Dim ds As System.Data.DataSet = New DataSet
 
      cn = New SqlClient.SqlConnection(myconnectionString)
 
cn.Open()
 
sSQL = "SELECT * FROM Attachment WHERE ID = " & attachmentRecordID
                           
cmd = New SqlClient.SqlCommand(sSQL, cn)
 
da = New SqlClient.SqlDataAdapter(cmd)
 
da.Fill(ds)
If (ds.Tables(0).Rows.Count = 1) Then
 
      ' ======================================
' ERROR GENERATED HERE
' ======================================
 
ds.Tables("Attachment").Rows(0).Item("BlobData") = fileBuffer
' ====================================== 
 
da.Update(ds, "Attachment")
 
Return True
Else
Return False
End If
 
Catch ex As Exception
Me.error_lbl.Text = ex.Message
            Return False
Finally
cn.Close()
End Try
==========================
Can anyone please help this one out.
Cheers.Imran.

View 2 Replies View Related

Error 10005 On SQL 2005 Server Running Powerbuilder Application

Feb 22, 2008

We are having problems with users getting the 10005 error when running the application.

This is a new sql2005 server. The DB's are in sql2000 format as the vender is not ready to upgrade application totally to 2005.
The users will have 3 instances of the application open and just one fails.

Any ideas on where to start would be great.

View 3 Replies View Related

SQL 7 With PowerBuilder 5,6

May 20, 1999

Has anyone connected from PowerBuilser 5 16 bit ODBC to SQL Server 7??
(PowerBuilder 6.x work)
In PB 5 I get message "name_column"'S DATA TYPE IS NOT SUPPORTED


THANK'S
BEST WISHES ,LEONID
20/05/99

View 1 Replies View Related

Powerbuilder 6.5 With DB2 8.1 On AIX

Oct 7, 2005

hi,
we are maintaining a powerbuilder 6.5 application which uses IBM DB2 8.1 as backend. The database is currently on Solaris server. We are moving this to AIX box. Could someone guide me regarding the settings to be given in pbodb60.ini file for AIX to support remote procedure calls?

The current entry for the SUN OS is as follows:

; IBM DB2/SUN 2.1 DB2CLI
[DB2/SUN]
PBCatalogOwner='PBCATOWN'
PBSyntax='DB2CS_SYNTAX'
PBDateTime='ISO_DATETIME'
PBFunctions='DB2CS_FUNCTIONS'
DelimitIdentifier='YES'
PBSystemOwner='SYSIBM,SYSSTAT,SYSCAT'
IdentifierCase=3
PBSupportBindSelect='NO'
PBSupportBindUpdate='NO'
PBSupportDBBind='YES'
PBTrimCharColumns='YES'
BlobSegmentSize=32767
ForeignKeyDeleteRule='Disallow if Dependent Rows Exist (RESTRICT),Delete any Dependent Rows (CASCADE),Set Dependent Columns to NULL (SET NULL)'
TableListType='ALIAS'

View 1 Replies View Related

PowerBuilder Problem

Mar 2, 2007

Hello,

I am trying to modify my MS SQL 2005 database by PowerDesigner model using PowerDesigner built-in Modify feature.

PD however seems to have problems reverse engineering the database.

I get tons of errors like this:
Reverse engineering tables...
Table _MyTable
Unable to list the columns.
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.
SQLSTATE = 37000

It also seems that it generates incompatible SQL code when modifying the database. E.g. (Parentheses after nonclustered violates syntax)...


create table _H_IpNetworkToVlanNetwork (
ipNetAddress bigint null,
vpnNetId int null default 0,
vlanId int null,
_ChangeDate datetime null,
_ChangeType int null,
constraint PK__H_IPNETWORKTOVLANNETWORK primary key nonclustered ()
)
go

What may be wrong? Do I have badly configured PowerBuilder? Or maybe badly configured ODBC data source?

Thanks for any help.

I have PowerBuilder 12.1 and MS SQL 2005

View 6 Replies View Related

Sending Uploaded Image To Data Access Class When Storing Image In SQL Server 2005

Apr 20, 2007

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 Related

How To Save Image In Sql Server And Display That Image In Datagrid??

Jun 27, 2007

Hay 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

View 5 Replies View Related

How To Store Image In Image Field In Sql Server 2000

Jul 12, 2007



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



View 5 Replies View Related

HOW To Retrieve An Image From Sql Server And Display It In ASP.net Using Imagemap Or Image ?

Jul 6, 2006

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.

View 4 Replies View Related

How Image Display From SqlServer To Image Control

Feb 13, 2007

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

View 4 Replies View Related

Inserted The Image In A Column----how Can I View The Image

Mar 7, 2006

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 Related

1st Image Control Shows Wrong Image

Jan 30, 2007

In 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

Image Located On Web, Url For Image Stored In Database

Aug 17, 2007



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

View 9 Replies View Related

Inserting Image File Into Image Column In DB

Sep 20, 2006

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!

View 6 Replies View Related

Updating A Table By Both Inserting And Updating In The Data Flow

Sep 21, 2006

I am very new to SQL Server 2005. I have created a package to load data from a flat delimited file to a database table. The initial load has worked. However, in the future, I will have flat files used to update the table. Some of the records will need to be inserted and some will need to update existing rows. I am trying to do this from SSIS. However, I am very lost as to how to do this.

Any suggestions?

View 7 Replies View Related

Inserting Image Data Type From SQL Server CE To SQL Server 2000.

Oct 23, 2006

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.

View 1 Replies View Related

Retrieving An Image From SQL Server

Sep 19, 2006

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 Related

Retrieving An Image From SQL Server

Sep 19, 2006

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 Related

How To Add An Image To An SQL Server Database

Jan 22, 2007

Hi 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

View 1 Replies View Related

Update Image In SQL Server

May 8, 2007

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, 
 

View 4 Replies View Related

Check Image In A SQL Server DB

Sep 4, 2007

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!

View 1 Replies View Related

Image Save To SQL Server

Apr 7, 2004

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?

View 4 Replies View Related

Default Image In SQL Server

Apr 24, 2004

Hi,

Is it at all possible to have a default image in an image field in sql server?

If so how?

Thanks,

JB

View 5 Replies View Related

Insert Image Into SQL Server In Asp.net

Mar 30, 2005

help me;
i want to insert image into SQL server

View 1 Replies View Related

Creating An Image Of A Server

Sep 24, 2007

Hello,

any one --can you explain the meaning of 'Creating an Image of a server.'

View 2 Replies View Related

Image Problem In Sql Server & Asp.net

Sep 8, 2007

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???

View 3 Replies View Related

SQL Server Image Data

Jul 20, 2005

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 Related

Image Files And SQL Server

Jul 20, 2005

Hello,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 Related

Image To Ssql Server

Apr 22, 2006

hi 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 Related

Read Image From Sql Server

Aug 6, 2007

Hello!

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!





View 3 Replies View Related

Image Storing In SQL Server 2000

Apr 15, 2007

HI,
Kindly Guide me how to store picture files in SQL server 2000 using Visual studio 2005
 
 

View 3 Replies View Related

Posting An Image To SQL Server 2005

Jun 22, 2007

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

View 2 Replies View Related







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