ADO.NET :: Add A Prefix Value With Existing Value While Updating A Column In Sql?
Feb 10, 2011how to add a prefix value with existing value while updating a column in sql??
View 4 Replieshow to add a prefix value with existing value while updating a column in sql??
View 4 RepliesSo my application is on a production and running smoothly with no bugs at all. yay! My question: Is there's more efficient way of updating an existing ASP.NET application? Here's what i'm currently doing ( dont laugh that's why im asking xD):
1. I compile the project,
2. after compilation i transfer the compiled files via ftp. then i delete the existing files on my folder and put the newer one.
I've a little problem, with a ASPX .NET application that I'm updating. After having updated the DLL and the ASPX files on the production server, my application is still running not modified. Is there a method to force IIS reloading the application without restarting the server?
View 1 RepliesI have two extremely long queries that I am running on multiple tables, using an INNER JOIN. The only difference between these two queries is that they take different input values for one of the WHERE clauses, which they get from two separate DropDownLists. The results of these queries are identical, save for the time1/time2 columns.string query1 = "select Name = t1.name, time1=(SELECT hours FROM table3 WHERE street=list1.selectedvalue), t2.address from [table1] t1 INNER JOIN [table2] t2 ON t1.param = t2.param ORDER BY Name"
View 1 RepliesPossible Duplicate: How to change programmatically non-identity column to identity one? I want to set a column as identity as I have already created this column in a table. What syntax do I need?
View 4 RepliesI have created small database prods. I have created one table Products. I have given columns like productid, productname, price. after creating table. I got an idea to add identity to productid ie., auto increment. how to add identity to existing column.
View 5 RepliesI have a table with several columns i created,
How can i add a new column and specify its data type now? i using sql server and Gridview.
I tried to add one using GridView but it shows me columns called edit delete something is not like my bound fields i created early.
article on binding to a list and I've got that working fine on one view. But what I'm stuck when doing it off a master record. Everything seems to work except that when I look in the database the detail records previous associated with the current master have their Foriegn key to master set to Null and a new set of detail records have been inserted. I've got a really simple form for this object
[Code]....
The form collection comes back with the expected prefixes:
[Code]....
And the Controller.UpdateModel(master) binds all the properties correctly. But when I call dbContext.SaveChanges it issues the follow sql from sql profiler (psuedo code)
[Code]....
I've got a work around that works but it's pretty hackish and I'm currently not matching up the keys so it's dependent on everything coming back in the right order. Plus I've got to include all the fields that I want updated.
[Code]....
I thought that entity framework's code first was the culprite but I've unit test that and it works fine. I've got a feeling that UpdateModel is somehow removing and re-adding the children. Has anyone else got this to work? Of course, I could throw in the towel and parse the indexed field names myself, but I'm so close!
tbl_salary
salary salperyr hike20 hike20yr
10000.0000 NULL 12000.00 144000.00
12000.0000 NULL 14400.00 172800.00
14000.0000 NULL 16800.00 201600.00
15000.0000 NULL 18000.00 216000.00
18000.0000 NULL 21600.00 259200.00
20000.0000 NULL 24000.00 288000.00
22000.0000 NULL 26400.00 316800.00
in above table salaryper yr (salperyr) has to be modified after caliculation my null values has to be removed and place(salary*12)in one shot.
I have tables:
MAILBOX
MailboxId int PK
MailboxTypeId int FK
MAILBOXTYPES
MailboxTypeId int PK
I can't make relationship between MailboxTypeId in table MAILBOXTYPES and MailboxTypeId in table MAILBOX why ?
I got this code which bind a datatable to a grid view. After the binding, i wanted to add additional column to the right of the grid, how can I do that? My codes below failed to do it.
[Code]....
The Header value of "ID1" is shown, but the cells only shows a '-' instead of 'New Column' sign.
I have Create and Edit forms for Categories. Columns are Id, CategoryName, Order, CreatedOn. On Create form I save the values for all but on Edit form I need to change only CategoryName. Below is the code. Problem is that on Edit form only CategoryName field exists which on submit button is passed to Edit Action. Whenever I update Order and CreatedOn becomes null because the values are not returned from form. Someone tell me any good approach how to Updated selected values in EF. Below is code.
Making multiple Get calls. Form is saving fine but I don't like the approach. Need clean approach. Anyone got better solution to thiis?
[Code]....
tbl_table1
ID primarykey (autoinc)
UserId uniqueidentifier
IdNumber primarykey int
I'd like to have a relationship between two tables.
This function is a virtual copy and paste from another function working just fine. It updates two columns in the database. One is a date and the other is a byte.
[Code]....
And the one not working. Below only updates the date column. The TimesRMEmailed column is not being updates. This is a byte.
[Code]....
#
Public
Class AdvanceLinkRegion
"Pvt Members"
[code]...
I have a DataGrid with a TemplateColumn containing an asp:DropDownList and a BoundColumn. I'd like to have a VB.NET handler for when the selected item in the DropDownList changes. I'd like this handler to also update the value in the BoundColumn with the value of the newly selected item in the DropDownList.
Can someone point me to some resources I can examine to learn how to do this?
If the handler for the selection changing can give me the value of the NEWLY selected item, it should just be a matter of accessing the cell for my BoundColumn in the same row and writing to it. I do not know the syntax to achieve this.
I'm trying to implement row editing on a gridview using a SQLDataSource, the updating works fine for all values in the row except for on value, Clock Reset Time. I have tried all sorts, tried converting to template fields, tried reordering columns, changing update query etc. I just cannot get the gridview to update the Clock Reset Time. here is the code.
[Code]....
I am using a gridview to show data in a formview on a ModalPopup. in the modal I have a Close button and Delete button. The delete button has a click even that is supposed to updated a column in the table, but it doesn't and I can't figure out why.
[Code]....
The varTransactionID variable gets value upon click of the gridview linkbutton so the value should be there. As you can see I have tried 2 ways of adding the Parameter Value of @TransactionID, they both do not work. The column never gets updated. [explanation] The reason why I do not just delete the record is that as Web Admin I want to still be able to view what changes are made to accounts so I can adjust the site to make things more user friendly, the user may not see the "deleted" record, but I still can.
I have a gridview in which update and delete is enabled.
I have the following fields in database table, which is binded to the grid view through sql datasource.
ID,Firstname,Lastname,Add,City,modifieddate. Here ID is primary key.
1. When edit and delete is enabled in the grid. The ID column is showing in the grid,which i don't want to show. But without that ID column the grid is not able to update and delete. Plz tel me how to update and delete without ID column in grid.
2. When ever any update is happen in the grid, the modifieddate should get updated. Here the date is not datetime.now , i need to use my own system date and time. Coz my server and system time has some difference.
I have use the following javascript to get system date and time, which is working fine. This date should be get and update in the modified column.
function displayTime() {
var m_names = new Array("Jan", "Feb", "Mar",
"Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec");
var localTime = new Date();
var year = localTime.getYear();
var month = localTime.getMonth() + 1;
var date = localTime.getDate();
var hours = localTime.getHours();
var minutes = localTime.getMinutes();
var seconds = localTime.getSeconds();
var div = document.getElementById("TextBox1");
div.innerText = date + "-" + m_names[month] + "-" + year;
}
I have been struggling with this problem for a long time. Does anyone have any clue about this problem? I created a gridview and set the allowsorting to true. This gridview has four columns: Name, Position, StartDate, and EndDate. I want the gridview to be sorted on the EndDate.
Inside of the save event, I called the BindGrid() function to rebind the datasource to the gridview. The changes will shown immediately, but the problem is that the records are not sorting on EndDate. I have to refresh the page manually to get the view sorted.
<asp:GridView ID="gvInfos" runat="server"
CheckBoxEnabled = "true"
ShowEmptyTable = "true"
AutoGenerateColumns = "False"
CssClass = "gv_white"
DataKeyNames = "Id"
GridLines = "None"
Width = "100%"
AllowSorting = "true"
>
<Columns>
<asp:ButtonField CommandName="Select" DataTextField="Name" HeaderText="Name" />
<asp:BoundField DataField="Position" HeaderText="Position" />
<asp:BoundField DataField="StartDate" HeaderText="Start Date"
DataFormatString="{0:Y}" />
<asp:TemplateField HeaderText="End Date" SortExpression="EndDate">
<ItemTemplate>
<%# (((DateTime)Eval("EndDate")).Year == (DateTime.MaxValue.Year) || (DateTime)Eval("EndDate") == null) ? "Present" : ((DateTime)Eval("EndDate")).ToString("y")%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
In trying to improve 'user experience' with a GridView, I have an administrative application where a GridView is displaying records from a SQL table. One of the columns is a bit column, and is displayed as a checkbox in the GridView. I want the user to be able to simply check or uncheck the box while viewing the GridView, and the value in that column for that record is immediately updated. So I set AutoPostBack="true" on the CheckBox in the GridView's Template Field.
But tests are indicating that the column value is not actually getting changed, even though the page appears to post back and displays the newly checked (or unchecked) checkbox correctly. But if I check the SQL table directly the column's value has not changed.
If I am passed a datatable and I cant change the column structure..is there anyway to set an existing column to a Primary key so I can easily Find() the row I am looking for?
View 1 RepliesHow to add new column to existing datatable which is inside dataset using C# .Net ....
View 1 RepliesI have the following method:
Code:
XmlNode AttributeNode = xmlDocument.CreateNode(XmlNodeType.Attribute, fieldName, WILTSNAMESPACE);
AttributeNode.Value = fieldValue;
parentNode.Attributes.SetNamedItem(AttributeNode);
this create (for example):
<Person d2p1:PersonRole="Boss">
How do I add an attribute without the d2p1: prefix:
<Person PersonRole="Boss">
I want to add a dynamic prefix to the url for some of the Views in my site, e.g. [URL] but am having difficulty. Out of the box I have [URL] but need to set a prefix dynamically. I created another Route in the Global.asax like so, but is is even needed? If it is how do I call it from my controller?
routes.MapRoute(
"Questions", // Route name
"{dyna}/{controller}/{action}/{id}", // URL with parameters
new {dyna = "dyna", controller = "Quote", action = "Questions", id = UrlParameter.Optional } // Parameter defaults
);
I've a scenerio where i've to create a primary key with prefix Rad####. For example Rad0001. How to do that.
View 2 Replies