|
Error : parameter @pic, which was not supplied
|
|
|
|
|
Try to pass
<br />
System.DBNull.Value<br />
as parameter value when pic1 is null.
|
|
|
|
|
Error : Operand type clash: nvarchar is incompatible with image
|
|
|
|
|
There's your problem right there. nvarchar is a text based field, and you are trying to store an image in it - you need to change the column type in the database, or save the image to disk and store the location of the image in this field.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
hi, try the following code, it may help you.
int len = Upload.PostedFile.ContentLength;
byte[] pic = new byte[len];
Upload.PostedFile.InputStream.Read (pic, 0, len);
SqlConnection sq=new SqlConnection(...);
SqlCommand cmd = new SqlCommand ("insert into values(@pic)", sq);
cmd.Parameters.Add ("@pic", pic);
cmd.ExecuteNonQuery ();
modified 27-May-14 4:59am.
|
|
|
|
|
hi, try the following code, it may help you.
int len = Upload.PostedFile.ContentLength;
byte[] pic = new byte[len];
Upload.PostedFile.InputStream.Read (pic, 0, len);
SqlConnection sq=new SqlConnection(...);
SqlCommand cmd = new SqlCommand ("insert into values(@pic)", sq);
cmd.Parameters.Add ("@pic", pic);
cmd.ExecuteNonQuery ();
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 9:00am.
|
|
|
|
|
How can I use DataBase without attach ?
I want to write a program and use sql how can I Insert,... data to sql without attach database file ?
|
|
|
|
|
Hi,
what do you mean by 'attach'?
Regards
Sebastian
|
|
|
|
|
attach means not attaching dB file just put It in program's directory and use it like SQLEXPRESS
|
|
|
|
|
So you want to use the db file (sql-express) without attaching it to the server? Well I think this is not possible. But you could use another database like derby etc. which can be used without an existing server...
|
|
|
|
|
Simple. You can't. In order to use a database file it must be attached.
Bob
Ashfield Consultants Ltd
Proud to be a Code Project MVP
|
|
|
|
|
Dear all,
I am trying to access a xml configuration file from windows service. But it
is failing. configuration file is in the same directory from where I install
windows service. I dont want to give an absolute path to the location of
file. When I try to start windows service, it is expecting the XML file to
be in c:\windows\system32\.
Please let me know whether there is a way to access xml files from windows
service.
Thanks.
|
|
|
|
|
Hi,
you will need the absolute path to the file within your windows service if you don't want to copy the file to the windows-folder. Use the registry as a configuration for your service, write the registry value while installing and read the value within the service.
Regards
Sebastian
|
|
|
|
|
Do you mean the standard app.config? If so, it is expected to be in the same folder as your exe. In any other case its up to you to tell the service where to look, generally by an entry in the app.config.
Bob
Ashfield Consultants Ltd
Proud to be a Code Project MVP
|
|
|
|
|
You can determine the path to your service by looking for the ImagePath value in the registry.
object objImgPath = Registry.GetValue("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\[name of your service]", "ImagePath", null); ;
Be sure you have the rights to access this registry key (but a service should have this rights).
Greetings
Covean
|
|
|
|
|
Hello,
I need some help in order to solve a little,annoying problem-flickering.
I've built a Drawer, that works perfectly , but flickers alot,
the general idea is inserting each shape that the user wants to Draw into
a Drawing list and Draw the whole list in paint event each time.
In the last few days ,i've been reading articles about how to solve it,
I tried setting DoubleBuffer to true but it doesn't help at all.
I've seen some methods to stop the flicker in this web but i cant understand/use them.
I need something as simple as possible that of course works.
(c#, using System.Drawing.Drawing2D; creategraphics(); method
Thank you very much.
|
|
|
|
|
I've had similar problems in the past. I seem to remember that the only way that I was able to stop the flicker was to implement manual double buffering. See the article here[^] to see how to do this (and to first verify that your settings are correct to automatically double buffer the image prior to putting in a bunch of wasted effort).
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi All
I want to create below key in Vista OS in my C# application.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System
After the key creation i want to write NoDispCPL (DWORD)value to 1.
On vista onwards i am anable to create the key.
Can any one help ?
Thanking You,
Sunil G.
|
|
|
|
|
Hi,
could you send code, how you create the key, please
greetz
|
|
|
|
|
Hi,
I am using below method to write value
RegistryKey myRegKey = Registry.CurrentUser;
myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
Registry.SetValue(myRegKey.ToString(), "NoDispCPL", 123, RegistryValueKind.DWord);
Regards,
Sunil G.
|
|
|
|
|
Hi,
what you do exactly mean by "unable to create" ? Is there an error, or do you don't find the key in registry?
This article might help in last case: Windows Vista inbuilt sandbox registry[^]
Hope it helps
bye
|
|
|
|
|
Hi,
I am not getting any error and also registry is not created. Exe is runing under system account.
If I run as an administrator then only it creates the registry.
Regards,
Sunil G.
|
|
|
|
|
Hi,
did you try do read the key by your program or with regedit? Try to read it by your program
bye
|
|
|
|
|
Hi,
I have tried to read/write by regedit, it works fine.
but through my program it does not work.
Bye
|
|
|
|
|
User Account Control (UAC) is the problem here.
It only allows administrators to change or add keys, reading keys is no problem.
There is no way to bypass this, unless you disable UAC.
|
|
|
|