VS 2008 Sql Transaction - MyCommand.CommandText = "Insert Into Region"?
Nov 12, 2010
here is the link where sql transaction is used [URL]
in this line
Code:
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
RegionID is entered by user rather than auto generated ,so i have same problem but only difference is that if i have auto generated what code should i write in try block .
I find my own way redundant to perform an insert command in a master-detail transaction. Sample, is a Purchase Order, before inserting the details/items will need to find the master key otherwise were not able to make the details connection. Normally we send command to button object which will submit the whole page rather than part of it and these means were not able to capture beforehand the master key to refer in the details.
So, Im thinking of how you do efficiently a master/detail batch update like we normally do in windows apps.
PLZ find below my transaction. i feel that something is wrong in those lines especially in the insert in the table BARCOD0F .the gridview dont show the new updates .i closed the page and relaunch everthing but the updates are not considered
I've got all of my ASP.NET requests wrapped in a Session and a Transaction that gets commited only at the very end of the request. At some point during execution of the request, I would like to insert an object and make it visible to other potential threads - i.e. split the insertion into a new transaction, commit that transaction, and move on. The reason is that the request in question hits an API that then chain hits another one of my pages (near-synchronously) to let me know that it processed, and thus double submits a transaction record, because the original request had not yet finished, and thus not committed the transaction record.
So I've tried wrapping the insertion code with a new SessionScope, TransactionScope(TransactionMode.New), combination of both, flushing everything manually, etc. However, when I call Refresh on the object I'm still getting the old object state. Here's some code sample for what I'm seeing:
Post outsidePost = Post.Find(id); // status of this post is Status.Old using (TransactionScope transaction = new TransactionScope(TransactionMode.New)) { Post p = Post.Find(id); p.Status = Status.New; // new status set here p.Update(); SessionScope.Current.Flush(); transaction.Flush(); transaction.VoteCommit(); } outsidePost.Refresh(); // refresh doesn't get the new status, status is still Status.Old
I'm having problem in inserting text from a textbox in which user write or copy some text which may contain special characters ( " , . ) etc. If there is any special character it get conflict with CommandText Syntax and generates error in inserting. I want to insert all these characters. How could i do it?
I've created a custom gridview control with a custom datacontrolfield as well, which enabled me to have textboxes in the headercells of the gridview so I can filter each column value.
Now I've added textboxes to the footer row as well so I can allow users to insert data directly from the grid.
As you can see, I added an Insert and Cancel button in the footer row. Then I have my custom column. Now in the rowdatabound event of the grid, i'm trying to hook up the linkbutton click event to a handler:
Code: Protected Sub nsGrvContainer_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles nsGrvContainer.RowDataBound Select Case e.Row.RowType Case DataControlRowType.Footer Dim lbInsert As LinkButton = CType(e.Row.FindControl("lbInsertCN"), LinkButton) AddHandler lbInsert.Click, AddressOf odsContainerNumber_Inserting End Select
I find the control fine, but the click event never fires.
I'm working on an asp.net mvc application. Each user have his own time zone.Right now, I'm using "TimeZoneInfo.GetSystemTimeZones" to generate a drop down list in order for the user to select a timezone and this is what I store in my db
They are like that: Morocco Standard Time (00:00:00) UTC (00:00:00) GMT Standard Time (00:00:00) ...
I know that php use a different timezone set, they are "region timezone", for example: Europe/Paris Europe/London ...
My question is: is there a way to play with the region timezone (like php) in an .NET application? The only way I can think of is to bind each php region timezone to the .net timezone.Also, the "TimeZoneInfo.GetSystemTimeZones" list all of the timezone on the machine. Is the list different between windows server, windows vista, windows xp?
I want to pick the date from the table(Oracle) & want to insert it into the another table. In Pic see,I am picking the date of the second row. I convert the date to the dd/MM/yyyy format
I am using VB. ASPNET2008 to develope Web Application. I am not sure whether to insert control DATAGRID or DATAVIEW. Also, what Reference Library am I supposed to use in order to use the Control.
I want to have footer to insert the records in Gridview,I m binding the Gridview with the DataTable.
On page load ,I have no row in DataTable,SO Gridview is not shown.SO i insert the one row in DataTable on Page load so dat the Gridview is displayed.
I want to ask that is it possible to display Gridview on page load ,widout havng a row in DataTable because on page load I do not have any row in Datatable
I have three web forms to insert, read and edit data. I want to display single records on each page. My pages consist of textboxes, listboxes, and images. I currently achieved reading, inserting and editing using a datareader and parameter queries. I'm wondering the best way, to design web forms. Can i use stored procedures. Using stored procedures; is more secure or not, is more stable or not,
Environment: IIS 5.1 , OS Windows XP, SP3 , I.E 6.0, SQL Server 2008 and Visual Studio 2008I am quite new to development. I developed a small web application on VB.NEUser will login with UserID and Password, select the only Excel file and click 'submit' button. On Submit button, selected Excel file will be transfered from one location to another on network and insert the Excel column data in SQL server 2008.
I have a requirement for my client (100000/1 Lakh users) for a Asset Tracker portal (Laptops/Desktops) where in I have a show the Asset (Laptop/Desktop was with whom and currently with whom) history (Trace Infromation) on a Report. There might be a n no of users who have used the same laptop.
From the beginning till the end of the life cycle of an asset, the trace of asset owner needs to be captured thoughout.We need to show the asset history report in a single row of data.e.g: Laptop was with A then with B and then with C and Currently with C. Not alone user history we also need to capture the Region/Location information of the asset and certain other things too.
how to implement this since there are lot of assets which needs to be registered in the portal.I am using SQL 2005.
I have a template where I want to replace certain regions. In my example below, I want to extract the regions between the. comments, manipulate it, then replace them back after the manipulation. I do not need the logic to merge the fields, but I need to extract the regions so I can use my logic and place it back into the template. Does anyone know of an elegant or simple way to extract these regions? I am also hoping to extract the url values in the process as well if it is easy to do along the way.
I am trying to convert a solution using EntLib into using AppFabric caching. By help of a few extension methods this is a fairly pain-free process.
Extension methods I use: public static bool Contains(this DataCache dataCache, string key) { return dataCache.Get(key) != null; } public static object GetData(this DataCache dataCache, string key) { return dataCache.Get(key); }
But there are two features of EntLib I find difficult to convert. Namely "Count" (counting number of keys in cache) and "Flush" (removing all data from cache). Both could be solved if I could iterate the keys in cache. There is a method called ClearRegion(string region), but that required me to specify a region name on all Get/Put/Add-methods I use, which would require some manual error-prone work.
Is there any way to get a list of keys in cache? Is there a default region name I can use? How can I flush the cache when I haven't used a region name?
I need to deliver source code to client and my boss need to remove all the comments and #region sections from the whole web site source code.
So is there any functionality available in visual studio 2010 or may be in an other 3rd party tool available to do so, which can remove all the #region from all over the source code ?
Otherwise my developers has to do donkey work.... :(( and I don't wish it.
So I have two file for every .aspx page in VS 2010.
In .aspx.cs page I am able to add regions in my code using:
#region Name Region #endregion
My questions:
How to do it in file .aspx? #region seems working only in .cs file. organize better my code both for .aspx and .cs file? Do you know the keyboard shortcuts to expand or collapse all my region in my code?
I want o upload the folder to server. for that when user drag and drop the folder the i will get the path at that time ui will zip it uploadedd to the folder.