hi all.... i need code snippets for store and retrive tiff
fromat images in sqlserver....... kindy provide it.......
Answer / Naman Agarwal
Here is a basic example of how you can store and retrieve TIFF images using C# and SQL Server. Please note that this is a simplified example and might need to be adjusted based on your specific needs.nnStoring image:n```csharpnusing System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;n
Byte[] imgBytes = null;
Image img = Image.FromFile(@"path_to_your_image");
img.Save(new MemoryStream(imgBytes), ImageFormat.Tiff);n
SqlConnection con = new SqlConnection("Your Connection String");
con.Open();
SqlCommand cmd = new SqlCommand("INSERT INTO Images (ImageData) VALUES (@Image)", con);
cmd.Parameters.AddWithValue("@Image", imgBytes);
cmd.ExecuteNonQuery();
con.Close();n```nnRetrieving image:n```csharpnByte[] imgBytes = null;
SqlConnection con = new SqlConnection("Your Connection String");
con.Open();
SqlCommand cmd = new SqlCommand("SELECT ImageData FROM Images WHERE Id = @Id", con);
cmd.Parameters.AddWithValue("@Id", Your_Image_ID);
imgBytes = (Byte[])cmd.ExecuteScalar();
MemoryStream ms = new MemoryStream(imgBytes);
Image img = Image.FromStream(ms);n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain the use of virtual, sealed, override, and abstract method?
What are concrete classes?
What is data type c#?
How do you mark a method obsolete?
What does exclamation mark mean c#?
What are some of the commonly used commands in sqlcommand?
What is distribute by in hive?
what are wrapper classes?
Explain About friend and Protected friend
How do you debug an ASP.NET Web application?
1 Answers Rolta, Siebel Systems,
Does c# provide copy constructor?
What is a verbatim string literal and why do we use it?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)