|
Okay, here is my problem: I've got a web site that allows users to edit their profile. Part of this profile information will be used to populate a contact page which will include a picture of the user. Now, I'm able to upload the pictures just fine into a sql 2005 database and display that image, but if the user doesn't add an image (which they are allow not to do) then I get stuck on how to populate that into my sql stored procedure's parameter list. I keep getting an error every time I try saving the profile without an image in the file upload box. Here is the code that I am using to try to put in a dbnull value:
cmd.Parameters.AddWithValue("@picture", SqlDbType.Image).Value = DBNull.Value
Any ideas on what I'm doing wrong?
|
|
|
|
|
That doesn't look right to me. Can't you just put
cmd.Parameters.AddWithValue("@picture", DBNull.Value)
?
(Assuming your "picture" field allows nulls, of course...)
|
|
|
|
|
I guess make image field mandatory or call this method only if there is value in @picture.
Thanks,
RK..
|
|
|
|
|
hello
Can I start a thread from aspx code behind (long running stored proc call)
Thread SomeThread = new Thread(this.RunLongRunningCommand);
SomeThread.Start(SomeArg);
I'm worried aspx page worker's thread life cycle.
dev
|
|
|
|
|
|
As an alternative to using System.Threading, which I have to admit I find a difficult class to get to grips with, can I suggest an alternative method for executing a long running process (LRP) within as ASP.NET appliucation...
..this is only of any real use when you can set up your LRP in such a way that you can execute it by passing just an ID number (say to a database record), or at least only a relatively small amount of data to it via a QueryString.
Set up your LRP within a generic handler, say "lrp.ashx"
Them, in your webapage when you want to execute this, add:
Try
Dim request As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create(HttpPathOf("lrp.ashx")), System.Net.HttpWebRequest)
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
Dim postData As String = "id=" & nid.ToString ' for example - set up whatever data you need to post to the handler here
request.ContentLength = postData.Length
Dim writer As New System.IO.StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII)
writer.Write(postData)
writer.Close()
Catch ex As Exception
' whatever
End Try
Note: by
HttpPathOf("lrp.ashx")
I mean the full URL (ie starting "http://www.mydomain...." to lrp.ashx - you can't just use a relative URL or Server.MapPath
The above code will execute lrp.ashx in a new process, adn you can (for example) immediately redirect to another page while it is still executing, adn yor users will never know....
Perhaps someone here willl tell me why I shouldn't be doiung this, but I've found it works very well
And no, I can't translate it into C#!
|
|
|
|
|
I have just gotten my new assignment; which is to design an universal (generic) table editor in ASP.NET, that fetches data from SQL and is able to CRUD this data.
I quess this is a well known area to most experienced ASP.NET developers (I have just started with ASP.NET) so I presume there are solid code examples "out there".
I would be most thankful if someone provided a good solid example for the above mentioned.
Thanks in advance.
|
|
|
|
|
Have you tried Googling[^]?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
|
It is easy to calculate the SUM of Integers or Float values using Aggregate function 'SUM' in RDLC Report Viewer. But I am unable to calculate the SUM of Total Hrs Worked for an employee.Datatype of Total Hrs is varchar.That creates error.Is there any way out for this?Please suggest a wy to calculate sum in rdlc.
|
|
|
|
|
|
Hi All,
I have one Ajax ModalPopupExtender whose target id is one panel when inside panel i have say 2 text box say name and lastname
this contains one add button . validation i can do through java script but if i enter something here i want to check whether user exist or not if exist then this pop up should not go ...but it goes i can show it again through show javascript function
but it looks really odd
how to fix this issue.
Thanks,
amit
|
|
|
|
|
I think you should use a CustomValidator and an UpdatePanel inside the Panel that is displayed by the ModalPopupExtender.
|
|
|
|
|
I tried doing this way but not working can u provide me sample.
thanks,
amit
|
|
|
|
|
|
|
First I apologize u for my mistake..I will tell clearly my problem.i want to see output of my rdlc report page by page.What can I do for this?The report has enough records to display that do not fit on one page.Please help me..So I want to see output page by page..
|
|
|
|
|
sorry, this is not the solution of your problem. i just want to ask, how will I print rdlc without using select export.i enabled the print button but it seems it will not show. i've google but the result is only print without preview. i want it preview first then print using print button.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
|
hi,
i would like to know how to put the selectedvalue of dropdownlist in textbox of gridview.
I have a dropdownlist and textbox inside gridview.
when i select a list in dropdown, the selectedvalue will put in textbox.
note: dropdownlist is a multiple column. i will put only the 2nd column on textbox.
how will i do that?
thanks in advance
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
You will need to handle the datagrid event and set the properties appropriately. Maybe this will give you a start, DataGridDemo[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
thanks for your reply. but i don't need an edititemtemplate. becuase i will save my data on gridview by bulk meaning the gridviewcolumns is in textbox not label. the user will edit directly in gridview without clicking edit button.
it will update/save data in just one click. that is why the link you given is not what i need. my question is how will i put the dropdownselected value in textbox in gridview.
example.
Gridview
----------------
column1 | column2
dropdown | textbox
-------------------
when select dropdownlist, the selected value copy in textbox.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
You can either do it by using javascript onchange event of dropdown or by using server side selected index changed event.
|
|
|
|
|
It doesn't need to be in edit mode, and you can use JavaScript
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
C# Code
this.Dispatcher.BeginInvoke(delegate()
{
PropertyChanged(this, new PropertyChangedEventArgs("FileLength"));
});
VB.NET Code
Me.Dispatcher.BeginInvoke(Function() Do
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("FileLength"))
End Function)
But it is not working i tried the code convert for the same, then did google also but unable to get the correct syntax.
Plz help
|
|
|
|