|
|
i try doing the following
streamreader strReader = new StreamReader(@"c\logfile.pdf")
;
and then i pass it as parameter like this
SqlCmd.Parameters.AddWithValue("@Attachment", strReader.ReadToEnd());
But i get the following error message
System.Data.SqlClient.SqlException: Operand type clash: nvarchar(max) is incompatible with image
|
|
|
|
|
you want to use varbinary(max) instead.
|
|
|
|
|
will this handle any file format Leppie
|
|
|
|
|
omlac wrote: will this handle any file format
Yes, as long as you pass a byte[] into it (I see your snippet was reading a string, you probably want the bytes instead).
|
|
|
|
|
@Leppie
Thats correct im gettin an error that cant convert from string to byte, but how do i read a file as byte, may u please here.
|
|
|
|
|
|
|
You can use this, it's simple:
dataSet11.DataTable1.AddDataTable1Row(File.ReadAllBytes("C:\\File.ext"));
sqlDataAdapter1.Update(dataSet11.DataTable1);
Just u must using System.IO.
Dataset1.DataTable1 have 1 column, it's datatype is binary.
and File.ReadAllBytes("FilePath") raturn a byte[] datatype (equal binary).
Good Luck.
|
|
|
|
|
hi there! I have a question if anyone can help me. I have an app and two webBrowser controls, the first one is populated with html code, and the second one I am viewing a PDF file. There is a button on the form, and I want to know if I can like combine the data from both webBrowser controls and display them on a single PDF or image document. Thx ahead
|
|
|
|
|
Probably not without generating your own PDF. There are many article here on CP and the rest of the internet on that specific subject.
|
|
|
|
|
If you create the document by hand by merging the two existing documents I think you could, however I don't fully understand your question. Could you give an example?
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
here is the example, I mean the real problem: I have two documents: xml file and pdf file. From the xml file, I am creating an html table populated with the requested informations at a webBrowser control within my app. The pdf file is a file what is related with the data in the xml file and is used just for previewing a document with some items from the catalogue. Right now the user can preview the html table at one webBrowser and preview the pdf document at another webBrowser control. I want to merge them and put them in one single pdf document, instead of using two webBrowsers and more button pressing for a same action. Is that possible? Thx for the cooperation
|
|
|
|
|
Although as leppie says, you won't be able to actually modify the PDF document unless you use a tool to do that, my thought was that you could still host the table and PDF document in the same web browser, by generating the code for the web page to include the table and the embedded PDF (on the same page). I don't know if this would look good or not, but it might allow you to get rid of the other web browser.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
can you give me some idea (example) how I can try to do that and see how it looks a like? Thx ahead
|
|
|
|
|
Well you mentioned you were generating the html for the one web browser manually, so I'll assume you know how to do that. All you need to do now is add an embedded pdf document to that page, and set its url to the pdf document you want to show. Any time either the table (xml) or the pdf document changes, you'll still have to update the web browser's generated html, but at least this way it'll all be in one place, as you want:
src ="path/to/myPdf.pdf"
width="100%">
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
thx....this can help me with my issue, but I am done for today, I will continue working tomorrow. Thanks a lot and have a nice evening(day) bye
|
|
|
|
|
You're welcome.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
Hi,
I'm having problems with drag and drop of a cell value (copy) within one datagridview.
Please help.
|
|
|
|
|
Member 3031965 wrote: I'm having problems with drag and drop of a cell value (copy) within one datagridview
..and I'm having trouble understanding what your problem is as I appear to have left my psychic head at home today.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Dear All Hi,I am new to csharp, I want to create a Bar Graph without using the graphics class, I want to use a button and adjust its size so that it looks like a bar.I will populate the properties of the buttons (size,color,position) at the run time.
I need to create button instances at run time, I tried creating user objects of the button, but still I am unable to create many buttons at runtime.
Any help or ideas will be appreciated .
Thanks
|
|
|
|
|
Button b = new Button()
b.XXX = YYY;
this.Controls.Add(b);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi Greeg,
If I had to create 100 buttons ,I do not want to write this code 100 times. I want something which is like cloning or creating Instances, for a user object button.Its not clear to me how we can do it in csharp.
|
|
|
|
|
Buy a book
int left = 0;
int space = 1; //pix
for ( int i = 0 ; i < nbButtons ; i++)
{
Button b = new Button();
b.name = i.ToString();
b.Text = i.ToString();
b.Left = left;
c.Controls.Add (b); //C is a user control
left += b.Left + b.Width + space;
}
|
|
|
|
|
Thanks Lisan
I'll get some good books but until then this works.
int left = 0;
int space = 1; //pix
int nbButtons = 5;
for (int i = 0; i < nbButtons; i++)
{
GlassButton gb = new GlassButton();
gb.Name = i.ToString();
gb.Text = i.ToString();
gb.Left = left;
gb.Location = new Point(20 + (i*5) , 10 + (i *5) );
this.Controls.Add(gb); //gb is a user control
left += gb.Left + gb.Width + space;
}
Thanks again
|
|
|
|