|
also not calling Dispose on the connection object will not pool the connection
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
I tried your suggession as below but dose not solve the issue. The issue is not related to Oracle i guess. Because everything is same and I only have to reset IIS. Thats restores the database access to normal.
try
{
dbConn.Open();
}
catch(Exception ex)
{
dbConn.Dispose();
}
CA Keer.
|
|
|
|
|
cs8569 wrote: try
{
dbConn.Open();
}
catch(Exception ex)
{
dbConn.Dispose();
}
should be:
{
dbConn.Open();
}
catch(Exception ex)
{ }
dbConn.Dispose();
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
As per MSDN Note "To deploy high-performance applications, you need to use connection pooling. When you use the .NET Framework Data Provider for OLE DB, you do not need to enable connection pooling because the provider manages this automatically."
The connection will establish if "db_conn.Open();" is successfull. (The Err hits at this line) If its not successful that means there is no connection and I dont need to close or dispose it?
However I still tried what you have suggested. I also tried using OleDbDataAdapter believing that it will manage the connection its own and I dont need to take care of closing or disposing the connection. But both approches did not solve the problem.
CA Keer.
|
|
|
|
|
i use the following in web config file
<appsetting>
<add key="AuthLogName" value="12345"/>
<add key="AuthPwd" value="56789>
</;appsetting>
and in cs file, i access the above credentials using following
object.Proxy.Credentials = new NetworkCredential(app.GetValue("AccUName", Type.GetType("System.String")).ToString(), app.GetValue("AccPwd", Type.GetType("System.String")).ToString(), app.GetValue("AccDomain", Type.GetType("System.String")).ToString());
i wana avoid the code in cs fine and directly give it under web config file
how do i do
thanks
jiny
|
|
|
|
|
I think I can see why no one has responded yet to this post. I would like to help, but it is not clear based on the post what you are interested in accomplishing that is different than what you already have.
|
|
|
|
|
Hi all,
i want to add additional functionality in my DataGrid that when ever user click on any area of the DataGrid's row it shoud be highlighted and on double Clicking on the row would redirect the user to specific URl.
any help would be greatly appriciated.
Regards,
T a H i r
|
|
|
|
|
|
THanks Mike your links helped me alot.
|
|
|
|
|
Hi all,
Pls anybody can help me to build and maintain the Shopping Cart in asp.net 2.0 using C#?.
I didnt find any useful article for that.
Thanks in advance.
Regards,
Jay
|
|
|
|
|
Lucky for you I implemented sth similar recently.
What I did was to use Arraylists (They are very effective for scenarios where removal and insertion of data is integral).
You can add data into these arraylists appropriately on an event and consequently remove data. Then you can add a listbox to the page and for it's items add for example: (product name + no purchased + total price) i.e the concatenation of the 3 values into the listbox's item's collection. So if someone clicks on Add Item, It adds all items to their arraylists, and also to the listbox.
Let the listbox's selected index be the index for your arraylist when removing items from them
e.g productArraylist.RemoveAt(listbox1.SelectedIndex)
That's just about it.
You can go ahead and store your arraylists in Session Variables. If you want to add to a database, use a foreach to run through each arralist and call a method, passing it the items in the arraylist as it's data.
e.g: AddQuery(productArrayList.Items[i].ToString(), quanArrayList.Items[i].ToString(), etc)
So the AddQuery takes all the parameters and performs the database operations. Remember to make that method static and place it in the AppCode folder.
That's all the basic stuff you need to know about doing a shopping cart.
The rest is up to you.
Live in fragments no longer. Only connect.
|
|
|
|
|
Thanks 4 ur guidance.
I ve got the basic idea about building the Shopping Cart.
Happy programming...
Regars,
Jay
|
|
|
|
|
Here is a challenging question, as I have not found any suitable information on this after two days of searching:
Background:
I have a custom Business Class library that includes custom objects with nullable int and DateTime properties. In order to update this data, I have created a FormView control bound to an ObjectDataSource that retrieves a generic List collection of my business objects. The reflection that is intrinsically called by the FormView/ObjectDataSource combination dutifully builds my basic Select, Update, and Insert templates. Now, when you edit the various (TextBoxes by default) input fields and then call the Update method referenced in the ODS (ObjectDataSource), the ODS attempts to convert the data contained in the input fields to the corresponding Type of the property bound to said input field. This is where we run into our little problem...
Even though I have a nullable Integer property type (let's call it int? ClassNumber), if the corresponding TextBox is empty (since it's not required), an exception is thrown by the ODS since it tries to convert an empty string value to an integer value before trying to set the object's Property. Hah! If ODS was able to determine that the integer is in fact nullable, it should pass in a null value instead! But alas, it throws a System.IndexOutOfRangeException: "Index was outside the bounds of the array" error. And further down the stack: "Exception: is not a valid value for Int32". Hmmm. Since this is a FormView control, we don't have the ability to use a BoundField control with 2 very useful properties: NullDisplayText and ConvertEmptyStringToNull. It would be nice to tell ODS to enable sending null values from any control we want. I wonder, can a TextBox control be extended to implement those two values? But I digress...
I suppose I could use the UpdateButton_Click event handler to evaluate the TextBox (or whatever) input controls in question and if the value is empty, input a default value (like zero), but this has Business Rule implications as well as invalidating the reason for using nullable types in the first place. Since I am creating my global Class Library as flexible as possible for use in many different web/desktop/whatever applications, I don't want to start implementing a hundred specialized case handlers, like if the int? value == 0, set it to null, because what if in other cases, 0 (or -1 for that matter) is perfectly acceptable? Once again, the reason for nullable types. Since I know that other developers may very well use a FormView with an ObjectDataSource, it might be handy to provide a custom (extended) FormView, textbox, or ODS control that can handle null values. Unless I am totally missing something else. DetailsView isn't template-able for Updating and I don't like updating from a GridView if there are a lot of fields. DataView is a pain, too.
Does anyone have any better suggestions?
Thanks ,
Joel
|
|
|
|
|
Sorry I didnt read the whole thing but lunch is here.
I havent used FormView much but cant you just modify the ItemDataBound event to control the nulls?
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
No. You can set the value of the form field in it's Data Binding event to some value if it is empty (such as 0 or -1) then handle that scenario on the business class such as set it to null if it is <= 0, but that only works for instances where the value has to be greater than 0.
The Updating event on the Object data source is too late in the hierarchy, as well as every other event where you could possibly send a null value to the data binder. It seems as though the ODS instructs the FormView control as to the type it needs to convert the input fields' values to since all the conversion is attempted before the data is bound to the ODS.
|
|
|
|
|
Does this help?
Data controls support a variety of ways to handle null or missing data. To begin with, the GridView, FormView, and DetailsView all support an EmptyDataText or EmptyDataTemplate property that you can use to specify a rendering for the control when the data source returns no rows of data. Only one of EmptyDataText and EmptyData needs to be set (EmptyDataTemplate overrides when both are set). You can also specify a ConvertEmptyStringToNull property on BoundFields or data source parameter objects to specify that String.Empty values posted from the client should be converted to null before invoking the associated data source operation. ObjectDataSource also supports a ConvertNullToDbNull property that can be set to true when the associated method expects DbNull parameters instead of null (the TableAdapter classes in a Visual Studio DataSet have this requirement). You can also specify a NullDisplayText property on BoundField to specify a value for the field to display when the field value from the data source is returned as null. If this value is not changed during edit mode, the value will roundtrip as null back to the data source during an Update operation. Lastly, you can also specify a DefaultValue property on data source parameters to specify a default value for the parameter when the parameter value passed is null. These properties can a chaining effect, for example if both ConvertEmptyStringToNull and DefaultValue are set, a String.Empty value will first be converted to null and subsequently to the default value.
But since your objects receieve null they would be defines as object. and you would think that it would just create the object type and be okay.
Hope that helps,
Nick
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
Nick,
I appreciate your comments, however, since this is a FormView control, I cannot use BoundFields, which are the ones with the helpful EmptyDataText and ConvertEmptyStringToNull properties. These properties are unavailable on TextBox, FormView, and ObjectDataSource controls. BoundFields can only be used in GridView, DetailView, and DataList controls. Since no null values are being sent up to my object (using two-way binding), I have to handle empty text boxes differently. My properties include String, nullable DateTime, nullable Integer, and nullable Decimal types. Therefore, DBNull is irrelevant.
Wait a minute! I've got an idea! I'm going to try setting the ODS flag, ConvertNullToDBNull, to true and see if it sends empty text boxes as DBNull, since it won't send null. If so, I can simply catch DBNulls in my properties' set property bag and just handle it as a null value from there!
I'll let you know if it works.
Thanks,
Joel
|
|
|
|
|
yeah. I want to test this out also. It seems ignorant to have an object source control and not send null.
-- modified at 17:20 Friday 28th July, 2006
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
And I would also think that you can set the UpdateMethod to call a custom update method to override the update pattern used.
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
There are two solutions depending on whether you specify parameters or pass objects.
If you specify parameters to ODS - it's pretty simple:
void ItemUpdatingProcessor(ObjectDataSource o,FormViewUpdateEventArgs e)
{
foreach (Parameter param in o.UpdateParameters)
{
if (e.NewValues[param.Name] != null && e.NewValues[param.Name].ToString() == string.Empty)
{
if ((param.Type == TypeCode.Decimal || param.Type == TypeCode.Double ||
param.Type == TypeCode.Int32 || param.Type == TypeCode.Byte ||
param.Type == TypeCode.Single || param.Type == TypeCode.DateTime ||
param.Type == TypeCode.Boolean) &&
param.ConvertEmptyStringToNull == true &&
(param.Direction == System.Data.ParameterDirection.Input ||param.Direction == System.Data.ParameterDirection.InputOutput))
{
e.NewValues[param.Name] = null;
}
}
}
}
If you are passing objects, then custom method:
protected void FixItemUpdating(string[] ignoredList, FormViewUpdateEventArgs e)
{
foreach (var key in e.NewValues.Keys)
{
if (ignoredList.Contains(key))
continue;
if (e.NewValues[key] != null && e.NewValues[key].ToString() == string.Empty)
{
e.NewValues[key] = null;
}
}
}
And "ignoredList" - list of fields that allow empty strings and not allow nulls ( ended up empty for my projects, but you just never know.
|
|
|
|
|
Hi,
Can anyone tell me how to retreive the SelectedValue from a
RadioButtonList, using javavscript.
I need to show it in alert box.
Thanx
nikesh
|
|
|
|
|
Hi,
Example,Get value from Radion Button
it will alert:
Hi ASP.NET
,,,,,,,,,,,,,,,,,,,
Hy Chanhan
|
|
|
|
|
Probably you are looking for this:
http://www.thescripts.com/forum/thread448965.html
Best Regards,
Apurva Kaushal
|
|
|
|
|
I wish I had some demo to refer on how to insert new rows to a gridview thus updating that database. C#.
thanks in advance. Much appreciated.
|
|
|
|
|
|