|
|
|
you can use this code to insert a image
codebehind c#
private void getIMGproperites()
{
HtmlInputFile imageItem = this.FindControl("Img") as HtmlInputFile;
Int32 intImageSize;
string strImageType;
Stream ImageStream;
intImageSize = imageItem.PostedFile.ContentLength;
strImageType = imageItem.PostedFile.ContentType;
ImageStream = imageItem.PostedFile.InputStream;
imageInsert(intImageSize, strImageType, ImageStream, intAlbumId, struseridHome);
}
public static string imageInsert(Int32 intImageSize, string strImageType, Stream ImageStream, Int32 intAlbumId, string struseridHome)
{
string path = "Database=master;Server=noussrv1010;pwd=sa;uid=sa;";
SqlConnection conn = new SqlConnection(path);
string strStatus = MyConstants.StrStatusOne;
byte[] ImageContent = new byte[intImageSize];
int intStatus;
intStatus = ImageStream.Read(ImageContent, 0, intImageSize);
SqlCommand myCommand = new SqlCommand("PNP_Inspic", conn);
myCommand.CommandType = CommandType.StoredProcedure;
SqlParameter imgEmail = new SqlParameter("@Email_ID", SqlDbType.VarChar, 40);
imgEmail.Value = struseridHome;
myCommand.Parameters.Add(imgEmail);
SqlParameter imgAlbumId = new SqlParameter("@PKAlbum_Id", SqlDbType.VarChar, 40);
imgAlbumId.Value = intAlbumId;
myCommand.Parameters.Add(imgAlbumId);
SqlParameter imgImageact = new SqlParameter("@Image_act", SqlDbType.Image);
imgImageact.Value = ImageContent;
myCommand.Parameters.Add(imgImageact);
SqlParameter imgImageType = new SqlParameter("@Image_Type", SqlDbType.VarChar, 255);
imgImageType.Value = strImageType;
myCommand.Parameters.Add(imgImageType);
SqlParameter imgImageSize = new SqlParameter("@Image_Size", SqlDbType.VarChar, 400);
imgImageSize.Value = intImageSize;
myCommand.Parameters.Add(imgImageSize);
SqlParameter imgImageSubdate = new SqlParameter("@Image_Sub_date", SqlDbType.DateTime);
imgImageSubdate.Value = DateTime.Now;
myCommand.Parameters.Add(imgImageSubdate);
try
{
conn.Open();
myCommand.ExecuteNonQuery();
conn.Close();
}
catch (Exception ex)
{
strStatus = MyConstants.StrStatusTwo;
throw ex;
}
finally
{
struseridHome = null;
}
return strStatus;
}
AND THE PROCEDURE to insert the image
--***********************
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PNP_Inspic]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[PNP_Inspic]
GO
/****************************************************************************************************************
Insert/Update data from PNP_UPLOAD_FILES table
***************************************************************************************************************/
CREATE PROCEDURE PNP_Inspic
(
@Email_ID as nVarchar(40),
@PKAlbum_Id as nVarchar(20),
@Image_act as Image,
@Image_Type as nVarchar(255),
@Image_Size as nVarchar(400),
@Image_Sub_date as Datetime
)
AS
BEGIN
INSERT INTO PNP_UPLOAD_FILES(Email_ID,PKAlbum_Id,Image_act,Image_Type,Image_Size,Image_Sub_date)
VALUES(@Email_ID,@PKAlbum_Id,@Image_act,@Image_Type,@Image_Size,@Image_Sub_date)
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
---***********************
winnie
|
|
|
|
|
codelinks wrote: INSERT INTO PNP_UPLOAD_FILES
You could have at least cut down your application-specific table names or comments.
|
|
|
|
|
soory dude no time for that,, otherwise would have given a very good code
winnie
|
|
|
|
|
My problem is this:
I got a client and I need to add the person I'll be talking to.
I click on the client's name I go to a new page and I can't click new or anything in that page coz I don't have any previous contacts with this client.
the detailsview shows up empty. coz I'm posting back to the new contact page the code of the client.
can u help me plz
BiG RaLpH
|
|
|
|
|
Hi All,
I am designing a yellow page site for my client, I want to add Google Search Feature in the web site, but unfortunately I don't know how to do it.
Can anybody please help me?
Thanx in advance.
Regards,
Paramhans Dubey.
|
|
|
|
|
|
Thanx Vasudevan for ur help
|
|
|
|
|
Hi all,
I am using asp.net2.0 and C# VS2005.
I am creating asp.net web server control templates Dynamically .
My requirement is such that sp return very no of field( 4 or 5 or 6 …).
Now I am assigning it to datalist by creating web server control template dynamilly.
My problem is as no of field return very .how can I change databinding(which is method of itemplate) method so that I can bind data as per field. That is how can I change the behavior of method Item_DataBinding(itemplate interface) so that it accept parameter
Please help.
Code i am using …….
public class MyTemplate:ITemplate
{
ListItemType templateType;
String para1, para2, para3, para4, para5;
public MyTemplate(System.Web.UI.WebControls.ListItemType type , string parameter1)
{
templateType = type;
para1 = parameter1;
}
//
public void InstantiateIn(System.Web.UI.Control container )
{
PlaceHolder ph = new PlaceHolder();
ImageMap imp = new ImageMap();
//declaration
imp.ID = "img1";
switch (templateType)
{
case ListItemType.Header:
// ph.Controls.Add(new LiteralControl("<html> <body>"));
ph.Controls.Add(new LiteralControl("<table border=\"1\">" ));
break;
case ListItemType.Item:
ph.Controls.Add(new LiteralControl("<tr align = left><td align = left >"));
ph.Controls.Add(imp);
// some code
//optional parameter
if (!((para1 == "categoryid") || (para1 == "customerid") || (para1 == "retailprice") || (para1 == "subcategory")))
{
ph.Controls.Add(item5);
ph.Controls.Add(new LiteralControl("<br />"));
}
ph.Controls.Add(new LiteralControl("</td></tr>"));
ph.DataBinding += new EventHandler(Item_DataBinding);
break;
case ListItemType.Footer:
ph.Controls.Add(new LiteralControl("</table>"));
break;
}
container.Controls.Add(ph);
}
// container code end
<b>static void Item_DataBinding(object sender, System.EventArgs e )
{
PlaceHolder ph = (PlaceHolder)sender;
DataListItem ri = (DataListItem)ph.NamingContainer;
//RepeaterItem ri = (RepeaterItem)ph.NamingContainer;
string impValue = (string)DataBinder.Eval(ri.DataItem, "photopath1");
// item1Value = (Int32)DataBinder.Eval(ri.DataItem, "CategoryID");
String item1Value = (String)DataBinder.Eval(ri.DataItem, "Categoryid1");
String item2Value = (String)DataBinder.Eval(ri.DataItem, "subcategoryid1");
String item3Value = (String)DataBinder.Eval(ri.DataItem, "customerid1");
String item4Value = (String ) DataBinder.Eval(ri.DataItem, "retailprice1").ToString() ;
((ImageMap)ph.FindControl("img1")).ImageUrl = impValue;
((Label)ph.FindControl("item1")).Text = item1Value.ToString();
((Label)ph.FindControl("item2")).Text = item2Value.ToString();
((Label)ph.FindControl("item3")).Text = item3Value.ToString();
((Label)ph.FindControl("item4")).Text = item4Value;
</b> }
}
thank you.
imran khan
|
|
|
|
|
sir ,
I want to implement barcode concept on asp.net application please give idea about it.
thanks
|
|
|
|
|
|
Why is it that I answered you, and you didn't bother to reply to me ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
how to find out user name and domain name of a client browing aserver using asp.net
|
|
|
|
|
the following value contains the username in the format domain\userid:
Request.ServerVariables("LOGON_USER")
This assumes you are using integrated authentication on the website. If you are not, that value will be empty.
|
|
|
|
|
hi friends
this is my code
dtbDataTable=new DataTable();
cmd1.Fill(dtbDataTable);
DataTable binddatatable=new DataTable();
if (zc!=null) requests=ServiceRequest.resortByDistance1(requests,zc);
DataGrid1.DataSource = dtbDataTable();
i need to pass "request" string in datatable
how can i achive this.
regards
saravanan
regards
saravanan
|
|
|
|
|
saravanan05 wrote: i need to pass "request" string in datatable
I'm not sure what you meant.
Do you wanna add "request" string to DataTable?
Then, you can write like that ~
Dim dr as DataRow = dtbDataTable.NewRow()<br />
dr(0) = request<br />
dtbDataTable.Rows.Add(dr)
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hi Friend,
I am calling an ASP.net 2.0 webservice in javascript by using "webservice.htc". It is working perfectly in IE 6 and 7 but unfortunately not in Firefox. I need to fix this problem in firefox. Please tell me solution of it. How can I fix it? Please.
Kind Regards,
Abubakar
|
|
|
|
|
htc doesn't work on non-IE browsers. So, you will need to re-write in Javascript...
-- modified at 22:57 Wednesday 29th August, 2007
Edit: Spelling
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Michael Sync wrote: non-ID
Did you mean non-IE ?
|
|
|
|
|
Vasudevan Deepak Kumar wrote: Did you mean non-IE?
Yeah.. D and E are so near in keyboard..... Thanks. man..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
|
Hi There,
Can anyone help me with an idea on how to disable the browsers feature to remember passwords once I login. I need to disable this in code behind, just before the user login.
I mainly work in IE and firefox.
Thank you
|
|
|
|
|
You can probably disble the cache. OR use SSL for your web application.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
autocomplete=off as an attribute to the FORM tag.
|
|
|
|