|
I am getting Input string was not in a correct format with the following code:
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_connection.Open();
sql_command = new MySqlCommand("sp_check_if_member_exist", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_command.Parameters.AddWithValue("param_member_id", MySqlDbType.Int32).Value = Convert.ToInt32(Request.QueryString["id"]);
sql_command.Parameters.AddWithValue("param_member_guid", MySqlDbType.VarChar).Value = Convert.ToString(Request.QueryString["guid"]);
sql_command.Parameters.Add("param_is_exist", MySqlDbType.Bit).Direction = ParameterDirection.Output;
sql_reader = sql_command.ExecuteReader();
sql_reader.Read();
if (sql_reader.HasRows)
{
if (Convert.ToBoolean(sql_command.Parameters["param_is_exist"].Value) == true)
{
panelMessage.Visible = false;
panelActivation.Visible = true;
}
else
{
panelActivation.Visible = false;
lblMessage.Text = "Error activating your membership!";
panelMessage.Visible = true;
return;
}
The error occurs on this line:
sql_reader = sql_command.ExecuteReader();
where is my mistake?
|
|
|
|
|
There are three suggestion and I think it supposed to be one of them:
1. Check you are entering correct store procedure name
2. Check you are entering correct parameters names
2. Check you are entering correct parameters values
Meysam
|
|
|
|
|
check d database.... used text field values are should not be empty..........
|
|
|
|
|
SqlCommand.Parameters.AddWithValue() does not take datatype as an parameter. You should add the parameter name and value (not datatype)
sql_command.Parameters.AddWithValue("param_member_id", Request.QueryString["id"]);
http://derekreynolds.wordpress.com/2011/05/16/using-sqlcommand-and-addwithvalue-parameters-to-execute-sql-insert/[^]
But your error "Input string was not in a correct format" is because some convert's did not succeed. When converting strings-->int etc you should use TryParse
private static void TryToParse(string value)
{
int number;
bool result = Int32.TryParse(value, out number);
if (result)
{
Console.WriteLine("Converted '{0}' to {1}.", value, number);
}
else
{
if (value == null) value = "";
Console.WriteLine("Attempted conversion of '{0}' failed.", value);
}
}
--------------------
When Chuck Norris' dreams come true, your worst nightmares begin.
|
|
|
|
|
why converting problem?
I only have two paramaters:
param_member_id which is int and it's int in MySQL.
param_member_guid which is varchar and it's varchar in MySQL
here is my values when getting error:
id=66&guid=9abc9f1e-e2f3-11e1-b39f-00ffceb1d3b5}
|
|
|
|
|
|
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.
|
|
|
|