|
1. Create a binary column in your database large enough to store the picture (image is a good choice).
2. Stream the target picture (System.Drawing.Image instance or whatever) to a byte array (I generally use the System.IO.MemoryStream class and the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter to create the byte stream for writing to the DB)
Example Image Encode:
=====================
Image myImage = Image.FromFile(filePath);<br />
MemoryStream stream = new MemoryStream();<br />
BinaryFormatter formatter = new BinaryFormatter();<br />
formatter.Serialize(stream, myImage);<br />
<br />
byte[] imageBytes = stream.GetBuffer();<br />
<br />
3. To retrieve the target image, load the row containing it, and get the byte array from the column containing the image data, then use the System.Drawing.Image.FromStream static method to instantiate a new Image instance.
hope this helps...
No design ever survives first contact with its users.
|
|
|
|
|
I am interested in creating an application that will write to cds from a web server but the files that it will first be in mp3 format first then the program will change the files into cda format to be burned to a cd. Could you please give me some direction?
Da Intern
|
|
|
|
|
There is library written by MS which exists in their site, its berning CD in .NET. Search MSDN for it,I don't have the link now.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
thanks for your help I have found that link now im trying to convert mp3 files to CDA files to burn onto the CD
Da Intern
|
|
|
|
|
Hello everyone,
I have a ASP.Net application which has crystal reports. For a batch process I want to create a console application in the same solution. Batch process takes about 2 or more hours to complete, console application would b a better solution as of my knowledge (if anyone has any suggestion, plz let me know). Problem is that reports exist in asp.net project, how do I use the same reports and its .cs files in the console application? I don't want to create a duplicate copy of reports.
Thanks in advance
Ali Haider
|
|
|
|
|
Sorting DataGrid BoundColumn using DataGrid.SortCommand
I have DataGrid control and I am adding BoundColumns at runtime.
My Questions are:
1) I need to sort DataGrid using DataGrid.SortCommand and **NOT** OnSortCommand as I am using CodeBack file.
2) I also need to Hide last column.
Below is code for aspx file
<%@ Page language="c#" Codebehind="DataGridSortingDemo.aspx.cs" AutoEventWireup="false" Inherits="Connection.DataGridSortingDemo" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>DataGridSortingDemo</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="DataGridSortingDemo" method="post" runat="server">
<asp:DataGrid id="DataGrid1" runat="server" AllowSorting="True" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
<ItemStyle ForeColor="#000066"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#006699"></HeaderStyle>
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox id="CheckBox1" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"></PagerStyle>
</asp:DataGrid>
</form>
</body>
</HTML>
Below is code back (aspx.cs) file
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Connection
{
public class DataGridSortingDemo : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
private void Page_Load(object sender, System.EventArgs e)
{
if( ! IsPostBack)
{
DataGrid1.DataSource = CreateDataSource();
DataGrid1.DataBind();
}
}
protected DataView CreateDataSource()
{
string strConnectionString = "user id=sa;password=;Database=Northwind;Server=localhost";
string strSQLQuery = "SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, 1 FROM Customers";
DataTable objDT = new DataTable();
BoundColumn objBoundColumn;
SqlConnection objSQLConn = new SqlConnection(strConnectionString);
SqlDataAdapter objSQLDA = new SqlDataAdapter(strSQLQuery, objSQLConn);
objSQLConn.Open();
objSQLDA.Fill(objDT);
objSQLConn.Close();
DataGrid1.AutoGenerateColumns = false;
for (int intCounter = 0; intCounter < objDT.Columns.Count; intCounter++)
{
objBoundColumn = new BoundColumn();
objBoundColumn.HeaderText = objDT.Columns[intCounter].ColumnName;
objBoundColumn.DataField = objDT.Columns[intCounter].ColumnName;
objBoundColumn.SortExpression = objDT.Columns[intCounter].ColumnName;
DataGrid1.Columns.Add(objBoundColumn);
}
DataView dvCommonDataView = new DataView(objDT);
return dvCommonDataView;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.DataGrid1.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.DataGrid1_SortCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DataGrid1_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
Response.Write("Hi There");
}
}
}
|
|
|
|
|
First please please delete your duplicate LONG message.
Second: You have to try this on ASP.NET furom.
ajaylulia wrote:
2) I also need to Hide last column.
Set Visible property to false.
ajaylulia wrote:
1) I need to sort DataGrid using DataGrid.SortCommand and **NOT** OnSortCommand as I am using CodeBack file.
The place for sorting is there and you havve to set SortExpression there. Why do you say you don't want to do it in that event?
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
1) The above code which I posted is working fine, but does not trigger DataGrid.SortCommand Event, when using BoundColumn. If I comment BoundColumn Code and set the DataGrid.AutoGenerateColumns to true, then the DataGrid.SortCommand Event in code back file is triggered properly.
2) If I dont use BoundColumn then I cannot set the Visible for last column (eg. Column No 7) to false, as DataGrid.Columns.count is always 1. The reason I get DataGrid.Columns.count as 1 is because first column in DataGrid is Template Column.
Ajay Lulia
|
|
|
|
|
When using non-blocking I/O in C++ a simple send() call could fail with WSAEWOULDBLOCK and the data is put in a message queue. When a FD_WRITE is coming in you can try send it again.
I wonder if this can happen with asynchronous sockets in .NET?
Can a send fail with WSAEWOULDBLOCK so that I need to use a message queue or does the framework do the second send for me?
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
This was already answered earlier (and many times before that) here[^]. Please click "Search comments" above before posting, because many questions have already been discussed many times.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
I am developing an ASP.NET C# Mobile Application. It works fine when I run it in a browser but if I run it on the openwave WAP emulator it is giving me an error, Malformed server response, when I try to go to the next page. I was thinking it might have something to do with the function I am calling to get it to go onto the next page, the function is RedirectToMobilePage(url). Any suggestions would be great.
Thanx
Rosie
|
|
|
|
|
Is this a server- or client-side function? Are you sure that WAP implements a scripting engine for Javascript? I honestly don't know since I've never cared to deal with mobile apps.
If this is a server-side method, are you canceling the response or letting the response complete. In most cases, you want the latter, otherwise an exception will be thrown if not handled correctly. So you should call RedirectToMobilePage(url, false); .
Also, this really belongs in the ASP.NET forum for future reference.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i can't load a Mesh into my directx App as it views as empty one
but when i see it in the mesh viewer utility it is there and i can see it
|
|
|
|
|
Sounds like you're not resolving the path to the file correctly. If your .X file is stored as a separate file, make sure you take the current working directory into account (may not be the application base), or use the application base by using Assembly.GetExecutingAssembly().Location . IIRC, the Mesh class can also accept a Stream , so if you embedded the .X file as an embedded resource, you can use Assembly.GetManifestResourceStream to get an instance of a Stream for the resource.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey
Is it posble to have controls like buttons, pictureboxes, and maby own made controls.
I have loot at the ListView.controls.add, but i dont get this to work and am not sure if this even have somthing to do with the windows form controls like buttons, pictureboxes etc.
Pleas help
//Jimmy
|
|
|
|
|
You can't add controls to the ListView like that - it's not a container. You can add controls but you need to owner draw everything, and I remember giving you links to a couple examples here on CodeProject. Use those and read about the List-View[^] common control for information on messages, notifications, styles, and such. .NET doesn't currently expose any simple way of doing this - you have to revert back to Win32 methods.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi.
i am developing a project in csharp.
and in this project i will mointor all
the files and application that will be
used by the user while he is logon on the
system.
Does any one have any idea or a link to
some project where i can find help about
this.
Thanks in Advance.
|
|
|
|
|
I think you can start with FileSystemWatcher control.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
You should look into Windows Hooks[^]. C# is really not the best language for this. C/C++ would be better suited for something that needs to be fast and may or may not load in-proc with other applications.
For more information on Windows Hooks, see Hooks[^] in the Platform SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
|
Hello Benzite!
If you enter into the article area, go into General C#, and enter the COM Interop list you will find a number of articles there. The two specific articles you want pertain to the IDocHostUIHandler hooks.
This is the link to my article:
http://www.codeproject.com/csharp/winformiehost.asp[^]
This is the link to Nicks article:
http://www.codeproject.com/csharp/advhost.asp[^]
Don't mind Heath. He helps alot but he has the bedside manner of a cold shower in the middle of winter.
Condor
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
|
Yep, and lets just let all the wannabe programmers breeze through life without doing their own work or looking things up. Congratulations for fostering the problem with this industry.
Besides, both articles you listed appeared at the top of the search results I linked anyway. I guess two clicks is one to many for you both? Oh, the pain...
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to develop an application that will not require the user having MS SQL or ORACLE or even Access (MS Office). Also I envisage that my data will accumulate to quite a large volume so I do not wish to use XML. What I am looking for is information on how develop and deploy a windows application with MSDE or JET. I would obviously deploy JET or MSDE with my application.
Any relevant refs?
Thanks
SFB
|
|
|
|