|
|
I think I have already answered this question in a different forum. Anyway, here is your problem
In this line:
sql_command.Parameters.AddWithValue("param_member_id", MySqlDbType.Int32).Value = Convert.ToInt32(Request.QueryString["id"]);
and the next two lines, you're actually passing Data Types (MySqlDbType.Int32) instead of the actual value. The AddWithValue() method expects the actual value rather than the data type. So do something like :
sql_command.Parameters.AddWithValue("param_member_id", Convert.ToInt32(Request.QueryString["id"]));
|
|
|
|
|
i am in project of mlm,and i am not knowing the idea how to give the commission for every registered user and to his parent and sub parents too
|
|
|
|
|
1. MLM = ripoff and in some places illegal.
2. It's simple basic math.
3. You have provided no information that anyone could use to help you. But then see #1.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
modified 10-Aug-12 11:13am.
|
|
|
|
|
Hi all, I am relatively new to Caching application block, so my problem can be very trivial. But I don't get it.
So there is this complex application (in production enviroment) that I have rewritten to use cache.
my framework is not so easy to describe, however: every service class (in the logic tier) has a father class that define the cache (static, so application wide)
SmallObjectCache = EnterpriseLibraryContainer.Current.GetInstance<ICacheManager>("SmallObjectCache");
I have written some classes to manage my cache: I use for single objects and for list of object (Read operation and GetAll operation)
protected virtual void CacheAddData(DomainObject domainObject)
{
if (domainObject != null)
{
CacheDictionary[this.GetType().FullName].Add(this.GetType().FullName + "_" + domainObject.GetId(), domainObject);
List<DomainObject> cachedObj = CacheGetAllData();
if (cachedObj != null && cachedObj.Count > 0)
{
int idx = -1;
try
{
idx = cachedObj.FindIndex(a => a.GetId() == domainObject.GetId());
cachedObj.RemoveAll(a => a.GetId() == domainObject.GetId());
}
catch (NullReferenceException)
{
BusinessFacade.ApplicationLogger.Write("INFO: Cache: Linq exception", Category.General, Priority.Normal, 1, System.Diagnostics.TraceEventType.Information);
}
if (idx >= 0)
cachedObj.Insert(idx, domainObject);
else
cachedObj.Add(domainObject);
CacheAddAllData(cachedObj);
}
}
}
So what the above do is to add an item in cache and if exist a list of that objects retrive it and add/insert in the right position the item.
Now the bug:
Everything is running fine. 100+ people use the system without a glitch. BUT sometime, near middle of the day, one or two people report a nullreference exception, especially in this code:
List<Utente> decoratori = GetAll().Cast<Utente>().ToList().Where<Utente>(u => u.Ruolo.IsDecoratore()).ToList();
the where iterator crash stating that object is null (I do checks before the only null objects can be the "Ruolo")
Now this is the issue: the same user with everyting unchanged became without an attribute (non deterministic).
Recycling the IIS memory fix the issue (so is not a reproducible issue).
I can't debug the issue because on my develop machine I have not this issue, bu I am one user and do same stuff.
BTW the application call garbage collection explicity very often , I don't know if this can be an issue.
I am becaming crazy (users complain a lot, as you can imagine...)
|
|
|
|
|
The thing about a cache is that you can't guarantee that it still holds data. A typical pattern with a cache is to attempt to retrieve an item from the cache, and if nothing is returned, the cache is refreshed with the data and then the item is returned.
It sounds as though this is your issue. Basically, something you are trying to retrieve is no longer present in the cache, so you recycle IIS which causes you to repopulate the cache because you go through your normal start up processes.
The only thing you can do to fix this is to add the functionality to check and reload the items.
|
|
|
|
|
I had a problem like that but with xml reading and writing. As more bots crawled the site, at a very fast pace, my program would crash, because the file was still open.
I had to really fine tune the program about 10 times, with more verification, and to open, read and close as fast as possible, then work in memory only, when done open write and close, then dump the memory and cleanup.
I know it's not the same problem, but in principal, the code had to be as efficient as possible.
|
|
|
|
|
In a C# 2010 web appplication, I would like to be able to debug javascript when I need to. I have not been able to accomplish this task so far. I have changed internet explorer to allow debugging.
I also want to mention in the web.config file I have the debug option set and I have the configuration manager set to cofmpile in debug mode.
Is there something in the visual studio.net 2010 ide that I need to set so I can see all the .net code? Not just the code I generated. If so, what option would I use?
modified 10-Aug-12 0:52am.
|
|
|
|
|
Firebug includes a powerful JavaScript debugger that lets you pause execution at any time and see what each variable looked like at that moment. If your code is a little sluggish, use the JavaScript profiler to measure performance and find bottlenecks fast.
http://www.dapfor.com/en/net-suite/net-grid/tutorial/data-types[^]
|
|
|
|
|
I am not looking for performance, I just want to know how to step through javascript code.
|
|
|
|
|
Just the same as you would in VS.
I.e
(a) set a break-point and wait until it gets hit or
(b) step into the js from the start
IE - hit F12 then set a break-point. Finally, hit the Start Debugging button
Chrome - Ctrl-Shift-I, then select Sources. Select correct js file from list, set break-point.
In each case, just click on the line number to add a break-point.
Make it work. Then do it better - Andrei Straut
|
|
|
|
|
I am trying to have a C# 2010 web form call another web page using a response.redirect and that is not working.
I am wondering if I can setup a
window.open('~/www.site.com'); return false;
to have a web form page point to the correct webpage I am looking for.
Can you tell me how to accomplish this goal by using a window.open statement?
|
|
|
|
|
Your question is vague. We cannot help you unless you mention the specifics.
What do you want to do? Do you want to redirect user to another page when the user clicks on a link? Or do you want to post data to another page? Or do you want to post data to server and redirect the user based on the response you get?
|
|
|
|
|
I want to post data to another page and return to the same spot I was at. When I return to my original page, I want to update the data as what was happening before.
|
|
|
|
|
There are 2 ways that you can achieve this.
1. Use a Ajax call to the other page and based on the result you get, you can update the current page. This is the easiest way.
2. Use a normal postback to the server, to the other page. While you do that, post the current URL as a parameter too. So in the other page, perform your logic, redirect to the passed URL and use session (recommended) or viewstate or some data store to send the values that you want to update the other page
Hope this helps and makes sense
Regards
|
|
|
|
|
window.open('http://www.site.com'); return false;
if you want to open a popup to another website
[EDIT]
you can't post data to another page in this manner.
Usually in this case, it's a credit card form, in which you get an api, and you populate your page with the textboxs, and then post to another page. The next page will consume the data, and send you back to the original page.
<Form id="whatever" and some attribute postback="nextpage.html" >
</form>
It's really not an asp.net issue, and just basic html, unless your using code behind to alter the form tag, or doing something fancy.
|
|
|
|
|
Does the
window.open('http://www.site.com'); return false;
only work in javascript? I am asking that question since I cannot get this to work in C#.
Can you also show me how to code the window open in a popup window?
Thans!
|
|
|
|
|
That's Javascript, doesnt' matter if it's c# or VB, Javascript runs on the client, and not the server.
dcof wrote: Can you also show me how to code the window open in a popup window?
Thans!
Your looking at it, in the last post and below, it open another browser instance or tab to the website you call.
window.open('http://www.site.com'); return false;
But you said you wanted to post data to another website, Javascript won't do that
It's the Form tag
http://www.w3schools.com/html/html_forms.asp[w3schools - Form Tag^]
[MSDN Form Tag^]
|
|
|
|
|
In a C# 2010 web form application, I would like to use a textbox object (or another object) that meets the following criteria:
1. The user can enter at least 8,000 or more characters,
2. The textbox wraps. In the same textbox area, the data wraps to the next line.
3. There are scrollbars that appear if needed. (this is optional)
The following is what I have so far but it only shows data on one line. i would like the data gto wrap to different lines:
<asp:TableRow ID="show"><asp:TableCell> asp:Label ID="LabelCauseText" runat="server" Text="Cause: " CssClass="whiteText" /> <asp:TextBox ID="TextBoxCause" runat="server" width="260" Wrap="true" MaxLength="25000" /> </asp:TableCell> </asp:TableRow>
Can you tell me what I can do to make the data wrap to more than one line?
|
|
|
|
|
Add TextMode="multiline" along with Rows="n" . Note that MaxLength does not work when the TextMode is set to multiline so you'll need to handle that separately.
<asp:TextBox ID="TextBoxCause" runat="server" width="260" TextMode="MultiLine" Rows="10" />
"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
modified 9-Aug-12 18:40pm.
|
|
|
|
|
When I use the code you suggested, it worked fine. However there is a scrollbar that appears and the scrollbar does not work. Thus can you tell me how to make the scrollbar work?
|
|
|
|
|
Scrollbar starts working once the number of rows exceeds the Rows count.
"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
|
|
|
|
|
This is the first time that I am submitting a array of data to a web service, sort of in reverse.
So a web service can only accept primitive values, I get it. I want to pick up a json array of values, but not sure how to go about it.
So here's the layout.
JSON input
{
"template_Name": "tshirts",
"template_Array": [
{
"name": "Red",
"code": "RED"
},
{
"name": "Green",
"code": "GRN"
},
{
"name": "Blue",
"code": "BLU"
},
{
"name": "Black",
"code": "BLK"
},
{
"name": "White",
"code": "WHT"
}
]
}
And the Function declaration of the Web Service
<WebMethod()> _
Public Function create_DynamicCart_Template(
ByVal template_Name As String,
ByVal template_Array() As String) As String
Dim dwExitCode As Integer = 2
Dim json_response As StringBuilder = New StringBuilder
Dim html_Stream As String = Nothing
So because the template_Array() contains the array marker, it's not a primitive.
I read that I have to consume the web service in another application, or perhaps I just take out the array () chars, and swallow it as a char array.
Maybe make a class that represents the array, template_Array As TA,
Any suggestions?,
|
|
|
|
|
Well that was hard, especially finding info on it in vb, everything was c#, so I had to translate it. Wrote this at 1:30, but had to take a service call. Just got back to test it.
So a list of template_Elements, qualifies as a primitive, or it simply consumes the web method before processing, and passes on the json array for my manipulation.
If you've got insight into this, let me know, would like to learn more about it.
I'm going to try to parse the JSON back into an array, and write out some XML with it, hope it works, or I'm back to the drawing board.
<WebMethod()> _
Public Function create_DynamicCart_Template(
ByVal template_Name As String,
ByVal template_Array As List(Of templateElements)) As String
Dim dwExitCode As Integer = 2
Dim json_response As StringBuilder = New StringBuilder
Dim html_Stream As String = Nothing
Try
Dim jss As JavaScriptSerializer = New JavaScriptSerializer()
Dim elements = jss.Deserialize(Of List(Of templateElements))(template_Array.ToString)
Then the class
Public Class templateElements
Private privateName As String
Public Property Name() As String
Get
Return privateName
End Get
Set(ByVal value As String)
privateName = value
End Set
End Property
Private privateCode As String
Public Property Code() As String
Get
Return privateCode
End Get
Set(ByVal value As String)
privateCode = value
End Set
End Property
End Class
|
|
|
|
|
I dealt with this problem just yesterday. I found a really really convenient way to that. But I am horrible with VB.Net otherwise I could have helped you out. Do you think if I post the C# code, you would be able to figure the VB.Net version of it?
Btw, my methods only works with .Net Framework 3.0 and above. Is that what you use? If it's 4.0 I can give you a very easy method
|
|
|
|
|