Parameter is not valid
Parameter is not valid
Parameter is not valid
Parameter is not valid
Parameter is not valid
Parameter is not valid Parameter is not valid Parameter is not valid Parameter is not valid Parameter is not valid Parameter is not valid Parameter is not valid
Parameter is not valid Parameter is not valid
Parameter is not valid
Visual Basic .NET Do NOT post questions here simply because you're using Visual Basic .NET. This forum is for syntax related questions only!

Enjoy an ad free experience by logging in. Not a member yet? Register.
Go Back  Xtreme .NET Talk > > > > Parameter is not valid


Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2017, 06:31 AM
mohanloges mohanloges is offline
Newcomer
 
Join Date: Aug 2017
Posts: 1
mohanloges is on a distinguished road
Unhappy Parameter is not valid



Hi,

i am new to vb.net, i have been struggling long days, that how to retrieve image from ms access database..i could successfully insert the image but i'm not able to retrieve it in picture box.

I used following code to insert image:

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
Dim bytImage() As Byte

Try
Dim ms As New System.IO.MemoryStream
Dim bmpImage As New Bitmap(PictureBox3.Image)

PictureBox3.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
bytImage = ms.ToArray()
ms.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try


con.Execute("insert into tutorial values('" & txtcnum.Text & "','" & txtcname.Text & "','bytImage')")

MsgBox("Saved Successfully")
End Sub

For Retrieve :



Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

Dim connection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;D ata Source=SVT.accdb;Persist Security Info=False;")

Dim command As New System.Data.OleDb.OleDbCommand("select photo from tutorial where c_num='" & txtcnum.Text & "'", connection)

connection.Open()
Dim pictureData As Byte() = DirectCast(command.ExecuteScalar(), Byte())
connection.Close()

Dim pictures As Image = Nothing

Using stream As New System.IO.MemoryStream(pictureData)
pictures = New System.Drawing.Bitmap(stream)

End Using
PictureBox3.Image = pictures
End Sub



i used the above code only. For retrieve i referred online, in online i got many codes but every codes telling the same error 'Parameter is not valid'. i'm full of headache..please kindly give me any source code for this..i attached screenshot...please refer it. Thank You..
Attached Images
File Type: jpg scr.jpg (283.3 KB, 4 views)
File Type: png dbscr.png (57.6 KB, 4 views)
Reply With Quote
  #2  
Old 08-11-2017, 05:00 AM
Goggy Goggy is offline
Newcomer
 
Join Date: May 2006
Posts: 10
Goggy is on a distinguished road
Default Re: Parameter is not valid

I can't test it but... the new constructor of the bitmap class doesnt take a stream as parameter...

try something like:

Dim Bla As Bitmap = Image.FromStream(yourStream)
Reply With Quote
Reply

Bookmarks

Tags
dim, retrieve, image, byte, pictures, code, system.eventargs, byval, handles, system.object, private, codes, tutorial, txtcnum.text, connection, parameter, online, bytimage, sender, insert, successfully, valid, refer, screenshot, attached

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Specified Cast Not Valid adrienne ASP.NET 1 06-03-2004 10:34 PM
COM object with CLSID {...} is either not valid or n fadi Interoperation / Office Integration 2 12-01-2003 06:34 AM
COM object with CLSID {...} is either not valid or n anacris Interoperation / Office Integration 0 10-23-2003 04:29 PM
Is this valid?? tehon3299 Database / XML / Reporting 2 02-10-2003 01:08 PM

Advertisement:







Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Parameter is not valid
Parameter is not valid
Parameter is not valid Parameter is not valid
Parameter is not valid
Parameter is not valid
Parameter is not valid Parameter is not valid Parameter is not valid Parameter is not valid Parameter is not valid Parameter is not valid Parameter is not valid
Parameter is not valid
Parameter is not valid
 
Parameter is not valid
Parameter is not valid