|
Hi guys,
I have a sql image field where I am saving pdf's to. I am now trying to archive these by converting them back to pdf's. I haven't been able to find any resources on how to do that. Please if anybody knows how to do this then I will appreciate it.
Thanks in advance
Sameer
|
|
|
|
|
Google for "save image to SQL database VB.NET". You'll find a tons of examples. A PDF file is no different than handling an image file.
|
|
|
|
|
I wasn't trying to save images/pdf's, I am doing that already, I was trying to extract them back to pdf's. I got it to work, thank you.
Sameer
|
|
|
|
|
Yep, and just about all the examples I've seen have the cofde to do BOTH sides of the operation, save and retrieve.
|
|
|
|
|
|
You are a life saver. Thank you very much.
Sameer
|
|
|
|
|
You are welcome
|
|
|
|
|
I'm trying to generate a new GUID in order to pass it as a value to a SQL Server 2005 db, however it is not working.
try
{
conAppDB.Open();
string _createNewTaskQuery = (@"INSERT INTO [teamwiki].[dbo].[task]
([task_ref
VALUES @task_ref);
string _newGUID = Guid.NewGuid().ToString();
SqlCommand cmdCreateNewTaskQuery = new SqlCommand(_createNewTaskQuery, conAppDB);
cmdCreateNewTaskQuery.Parameters.AddWithValue("@task_ref", _newGUID);
cmdCreateNewTaskQuery.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
finally {
conAppDB.Close();
}
Error:
System.Data.SqlClient.SqlException was unhandled by user code
Message="Incorrect syntax near '@task_ref'."
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
Class=15
LineNumber=19
Number=102
Procedure=""
Server="JCAMILLERI\\SQLEXPRESS"
State=1
StackTrace:
at TaskEntry.btnMultifunction_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\TaskEntry\TaskEntry.aspx.cs:line 108
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Jon
|
|
|
|
|
query is wrong, try:
INSERT INTO [teamwiki].[dbo].[task] ([task_ref]) VALUES (@task_ref);
|
|
|
|
|
SQL Server has the NEWID function which works pretty good too. Depending on what you need the guid for it may be better generated in the DB instead of the application layer.
Also, a pedantic comment. Using consistent variable naming will result in better code. While I prefer using the prefix m for members, others choose an _, however, few if any use the _ prefix for local variables and if they do they would do so consistently.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Thanks. I've actually tried using the SQL server NEWID function, however, although it was working fine when querying the database directly, VS 2005 (Team Edition) with .NET 2.0 had a hard time parsing the NEWID() part within the string containing the INSERT statement.
Comments noted as well, I hurried to mock up the problematic code
Jon
|
|
|
|
|
jon_80 wrote: VS 2005 (Team Edition) with .NET 2.0 had a hard time parsing the NEWID() part within the string containing the INSERT statement
That's perhaps the problem... Why would you try to make the C# code parse the query at all? It's just a string that it sends to the database.
What does your code look like?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Show the code you tried.
INSERT INTO table ( ID , ... ) VALUES ( NEWID() , ... )
should work fine.
|
|
|
|
|
Hi,
Could anyone point me at a good article on using IConfigurationSectionHandler. The Microsoft documentation shows how to implement the interface, but I can't find an example of calling the interface's Create function.
What are typical parameters for:
object IConfigurationSectionHandler.Create( object parent, object configContext, XmlNode section )?
Any help would be most appreciated.
Best wishes, Patrick
|
|
|
|
|
You sure you want to be using that Interface?
From the docs: " Important IConfigurationSectionHandler is deprecated in .NET Framework 2.0 and above. But, because it is used internally, it has been kept. You can find an example at How to: Create Custom Configuration Sections Using IConfigurationSectionHandler. If you use the previous example, please build it with the .NET Framework version 1.0 or 1.1.
In .NET Framework version 2.0 and above, you must instead derive from the ConfigurationSection class to implement the related configuration section handler. You can find an example at How to: Create Custom Configuration Sections Using ConfigurationSection. "
from http://msdn.microsoft.com/en-us/library/system.configuration.iconfigurationsectionhandler.aspx[^]
|
|
|
|
|
Good point - thanks. I had forgotten reading that important statement about 9 o' clock this morning (it's been a long day).
I actually started using the ConfigurationSection method, but I got side-tracked when I tried to figure out how to implement a collection as one of the properties. Could anyone point me at an example of how to do this?
Best wishes, Patrick
|
|
|
|
|
Good morning message board,
I am trying to read data from an xml string, and am getting a Object reference not set to an instance of an object. I am assuming this is because the following line of code is not finding a node in the xml string where profileURL is a string:
profileURL = xmlDoc.SelectSingleNode("fql_query_response/user/profile_url").Value;
The xml string i am trying to read is as follows:
<br />
fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true"><br />
<user> <br />
<profile_url>http:
</user><br />
/code><br />
<br />
Any help with this would be greatly appreciated as im not really clear why i am not registering a hit on a node. <br />
<br />
Thanks for the help, <br />
<br />
JL <br />
<br />
<div class="ForumMod">modified on Tuesday, January 20, 2009 1:16 PM</div>
|
|
|
|
|
Hello all,
I have coded a quite-complex (for me) website that contains many controls and some loaded code-behind pages. I launched the website, no problems there. A few months after all files are gone in a harddisk crash. Now I have a fully functioning ASP.NET website at hosting company's computer, but no code behind files... As long as website works, noo problem I thought, I can work on it "someday" in the future. But now hosting company changed their configuration and one of the user controls that contained hard-coded directory path does not work anymore (oh yes I know I shouldn't have hardcoded and instead used settings files... But "it" happens)... I really don't have time to code all that stuff and code behind pages contained many SEO tweaks, I don't think I can get them all right in one go (last time it took mo more than 2 months to get it almost-right).
I have temporarily solved the situation by removing the problematic user control. Now website works but that spot looks kinda empty and in a week or so I have to put there something and I don't really feel like coding the entire code behind pages. It took me 2 months to get together this babe...
My question is this: Is there an easier way around? For instance, can't I just write a single replacement user control and have it compiled? When I tried it (on VS 2005) it tells me the website is already pre-built and refuses to build/publish the website. When I wrote a simple user control, inserted in site.master and clicked on Preview I can see it's working, but I can't publish/build. So I figure there should be a way...
Any recommendations please? (P.S. I am a newbie and I am not a professional programmer; please take it easy on me )
Thanks,
Haluk
|
|
|
|
|
Oh another thing, I don't want to put static HTML there. I want to put another user control that prints a random list of keywords (tag cloud) from a wide list of keywords... So static HTML is not the option.
|
|
|
|
|
I think your best bet is to download a copy of Reflector[^] (don't worry, it's free) and use this to disassemble the DLLs in the website. You can then recreate the project (though it might be a bit of a slow process).
It definitely isn't definatley
|
|
|
|
|
Thank you really. It seems a good solution in the long run (i.e. for recovering the entire website). But I still need a quick and dirty solution for adding a new user control to my published website...
|
|
|
|
|
You're effectively talking about making changes to a compiled piece of code which leaves you with two options:
1. Recreate the project as described above; edit, rebuild & deploy.
2. Disassemble the DLL using ildasm.exe (prob found in c:\program files\visual studio 8\sdk\v2.0\bin) to get the IL code, amend this code by hand (if you're just changing hard coded references this might not be too difficult) and then use ilasm.exe to reassemble the DLL which you can then redeploy.
Given that you say you're not an experienced developer, I'd recommend that you invest a couple of hours in the first solution; the second is quick and dirty but it definitely isn't trivial.
It definitely isn't definatley
|
|
|
|
|
I checked ildasm already. It looked rather complicated and its been a few months since I coded this. So I guess I'll go with Refractor. Thank you for your time and valuable help. Kind Regards, Haluk
|
|
|
|
|
I came back to thank you. Thanks to Reflector I recovered all the code from binaries and rebuilt the website in just 5 hours Thanks for pointing me to right direction. You saved me a lot of time. All the best.
|
|
|
|
|
If I have a file that I assume is text, is there a process that can verify if its binary or not and to ensure it contains valid characters.
|
|
|
|