DataSource Controls :: Adding An Id Field Based On Other Fields

May 16, 2010

ive a DB in access with a single table and no primary key, actually i dont need a primary key but i can consider a date field plus another to make an index. however i want to add a counter field based on every change of date field, for instance ill have many records of 20/May and all must have the same id then when the date is different, the next group of records with that new date must show 2 etc.. is it a quick way to update my database?

View 6 Replies


Similar Messages:

DataSource Controls :: Adding 2 Fields Together And Inserting Into A Database?

Jul 6, 2010

I have an SQL datasource that successfully enters customer details into a table. What it includes is the persons address. First of all we add the persons address, then we add the persons name to that address in a seperate physical procedure. i.e. on a different form.

What I need to do is try and stop users entering the same address twice. The way I have thought of doing this is by making a string field called AddressIdentity and have this contain the door number and the postcode of the address with all the spaces stripped out. Then when adding the address, it checks if this exists before adding it. However I cannot work out how to put the 2 fields together without using the codebehind file, which I don't mind doing if I need to, but I'm sure its avoidable.

Here is my code - I have only included the relevant parts:

InsertCommand="INSERT INTO [tbl_shop_client_addresses] ([FlatNo], [Address1], [Address2], [Town], [County], [Postcode],
[Country], [Telephone], [DoorNo]) VALUES (@FlatNo, @Address1, @Address2, @Town, @County, @Postcode, @Country, @Telephone, @DoorNo)"
<InsertParameters>[code]......

So how do I do it? I was trying:

InsertCommand="INSERT INTO [tbl_shop_client_addresses] ([FlatNo], [Address1], [Address2], [Town], [County], [Postcode],
[Country], [Telephone], [DoorNo], [AddressIdentity]) VALUES (@FlatNo, @Address1, @Address2, @Town, @County, @Postcode, @Country, @Telephone, @DoorNo, @Postcode + @DoorNo)"

but of course AddressIdentity is a string. Do I use ' ' marks with an & sign? Or can't I do this?? Maybe I need to use the codebehind anyway to see if the field exists before inserting it?

View 2 Replies

DataSource Controls :: Updating SQL Data Fields By Field Index?

Jan 7, 2010

I have a situation where I have a file with each Account Record contains Monthly Expense Total Fields and Monthly Budget Fields for 2009, 2008 and 2007. I'm working with 72 fields (36 Expense and 36 Budget).

Need to create New Year Proceure that will shift data from 2008 to 2007, 2009 to 2008 and move Zeros to 2009 for both Expenses and Budgets.

I can do this using Parameters and Update SQL but I am under the impression that I must specificaly name each field in defining Parameters and SQL Update Command.

Since all fields are sequential withing a record, is there a way that I can use a For/Next loop to index my way through the fields moving data from one year to another?

When using DataReader I'm able to use reader.item(index) to access data record fields.

View 3 Replies

DataSource Controls :: Stored Procedure To Insert Value From A Text Field Into 2 Fields In Two Different Tables?

Mar 31, 2010

I want to insert username and password into two tables (say table1 as well as table 2) using stored procedure.

View 4 Replies

DataSource Controls :: Adding Field In A Existing Table?

Apr 9, 2010

I want to add a field in a Existing table.

I dont want to alter the whole table.

Give me Solution at the Design side.

View 3 Replies

DataSource Controls :: Adding A DateTime Field To A DataTable?

May 20, 2010

I'm looping through an ArrayList and creating a column in a DataTable from each field. One of my fields is a DateTime field, and I've noticed that when I create the columns, it's being changed to a String, but I need it to still be a DateTime field for sorting. I'm trying to do this, but it's not quite working.

[Code]....

View 3 Replies

DataSource Controls :: Adding New Field To A Table Mapped In LINQ?

May 25, 2010

I have a table added to a dbml file in my website. The website is already deployed to Live server. Now I have been instructed to a add a new field to the table. The field will be defaulted as getdate().

I don't plan to modify my dbml file for this change since the filed holds a default value. Will it cause any issue(performance related or any other). I am sure that I will not have to use the newly added field in the website. I am new to LINQ.

View 3 Replies

DataSource Controls :: Insert Into A Table Based On Another Tables Numeric Operator Field

Nov 11, 2010

I have a insert into statement thats inserting my numbers from a numeric text box on my aspx page. I am choosing the Amount Type then putting in a a number.

So i have a drop down that i select example Direct Charge then i enter 600.00 and click add it puts that in to the databse for me woot..

I then put in say Misc Credit and enter 200.00 it inserts in that into the database woot.

The look up table that has my amount types has a field called numeric opperator which is either + or - the Credit being a - and the Charge being a + then my stored procedure takes all my + numbers and adds them up and subtracts all the - numbers.

I want to change that so that it actuall be inserted into the table as a - number form the start. So I want choose Misc Credit enter 200.00 and click add then my event says o yea thats a credit insert 200.00 as -200.00

How can I do that?

[code]...

View 1 Replies

Forms Data Controls :: Changing Webpage Label Text Based On Datasource Field In A Repeater Control?

Jan 27, 2011

I have a web page that has a repeater bound to a data source. I beed to change a label inside the repeater based on the data that is in each repeater item. For instance, for the first item it might be one thing, and for the next item the label may be something else. I am currently doing some processing in the prerender event, but I don't know if I can or how to access the data source fields there. Where and how do I get access to the data in each item so I can change the label text?

View 3 Replies

DataSource Controls :: Retrieve Data From Data Base And Display A Field Based On The Dropdown?

Jul 6, 2010

I am in need to retrieve data from data base and display a field based on the drop down is selected

View 2 Replies

Forms Data Controls :: Disable/Invisible Field In Gridview Based On Another Field?

Jul 9, 2010

I have 2 fields in my gridview one called ScriptType the other BagNo, when a user click the edit button, I would like the BagNo filed to be disabled if the ScriptType field is = "TTA" and enabled otherwise. How can I do this?..something along these lines see below..I am using VB..

[code]...

View 14 Replies

Forms Data Controls :: Gridview Adding Fields?

Feb 24, 2011

are below all 3 points the same?

1)<boundfield>

<asp:button ....>

</boundfield> [code].....

View 10 Replies

DataSource Controls :: Ignore Empty Field Because Always Join The Field And Separate By Space

Mar 3, 2010

I wanna join all the field as a new col.

but how can i ignore the empty field because i always join the field and separate by space like the following.

select (field_1+' '+field_2+' '+field_3) as new_col from TABLEA

but if the field is empty, then there is the double space

how can i ensure all the space is one space only.

View 2 Replies

Forms Data Controls :: Adding Calculated Fields To A Databound Control?

Oct 14, 2010

I need a form that displays three columns drawn directly from a database (no problems here) as well as two fields that require some complex calculations. Not only am I lost as to how to incorporate the calculations into the control, I don't know exactly how to write the calculations. I am working in Visual Web Developer 2008 with Vb.NET.

The first of the two fields should take the sum of all payments made by a given customer and divide it by a DailyMembershipRate, returning a DaysPaid variable. It should take this variable and a CustomerSince field for that particular customer and calculate a PaidThrough field.

The second of the two columns similarly requires the DaysPaid variable described above. It should subtract the CustomerSince field from the current date and return the value in days, giving a MembershipDays variable. Finally, it should subtract MembershipDays from the DaysPaid variable, again returning a value in days, and then multiply this by the DailyRate value for a Credit/Deficit field.

I realize this is a lot, but I haven't been able to find any documentation either online or in VWD or ASP.NET texts on this topic. I could really use some fellow user input.

View 4 Replies

Forms Data Controls :: Is It Possible To Display The FullName Based On The Member Fields Of The Table

Dec 16, 2010

I am trying to display in the Gridview the Full Name of a person.

I have MemberFirstName and MemberLastName as fields in the Table.

Is it possible to display the FullName based on the member fields of the table ?

View 2 Replies

DataSource Controls :: Set Field As DBNull.Value If Field Is Blank?

Apr 7, 2010

I have a 20 to 30 fields on a form. Most of them are optional. However, the users can fill out what they want. If a user dosen't fill in a field when data is sent to the database it's sent as blank, instead of NULL. Is there a way I can generically say "for all textboxes if Equals("") then DBNull.Value". Without going through each and every textbox?

View 2 Replies

How To Fill In A Detailsview Field Based On The Value In Another Field

Apr 19, 2010

I have a Details view containing a 2 fields. A Name and a phone number.The Name field is a template with a dropdown list that's popuplated from a database table of Names and Phone numbers. The dropdownlist shows the names. When the user selects a name I want to put the phone number into the second field in the Detailsview.

View 1 Replies

Forms Data Controls :: Update Field Based On Value In Another?

Apr 9, 2010

In GridView (using VB) , I have project information, with Status and %Complete that the user is supposed to update. Trouble is they may change %Complete to 100%, but not change the status from Active to Complete. So, we wind up with a long list of Active tasks that are 100% Complete. How can I force an update to the Status field ? something like... If "%Complete" = "100" Else Status = "Complete" Not sure if I need to do this in VBscript or code behind or SQL or.

View 2 Replies

Forms Data Controls :: Adding Controls To A Webpage Based On The Results Of A SQL Sproc

May 11, 2010

Depending on the data returned from a Stored Procedure, I need to add specific controls to a page and then when they are populated by the user, write them back to the database. What is the easiest way of doing this?

View 9 Replies

Forms Data Controls :: Display Value Based On ID Field In Datalist?

Sep 20, 2010

I am trying to display a starting date from an access database based on the dateId field in a datalist.

On page 1 (using a master page) the customer selects a starting date from a dropdownlist. When the customer hits the submit button, they are transferred to page 2 where the selected starting date is displayed.

The database table is basically:

DateID Startingdate

1 1/1/2010
2 2/1/2010
3 3/1/2010
4 4/1/2010
5 5/1/2010

The dropdownlist from page 1 is:

[Code]....

My select command is:

[Code]....

View 4 Replies

Forms Data Controls :: Adding An Image To GridView Based On A Numeric Value?

Mar 26, 2010

I have been struggling for a while now to get this code working. In my mind, it should be fine. However, I cannot get this code to pass back an image url. If I explicitly name the image URL it will show, but the code will not return (or perhaps might not properly call) the url. Here are my 2 bits of code:

[Code]....

View 11 Replies

Forms Data Controls :: Select A GridView Row Based On Field Content?

Jan 18, 2010

I have a page with a Listbox and GridView.

The Listbox has a list of students. The Gridview has a list of classes offered during a period, such as:

Math Science English etc. When I click a student in the Listbox, I call a sproc via Linq, and get the ClassID and ClassTitle that student is registered for.

What I need to do is Highlight the record in the GridView that matches the ClassID or ClassTitle returned by the sproc.

Previously, I used a ListBox for the Class Offerings. This is easy with a Listbox using the FindByText method:

[Code]....

What is the right way to do this with a GridView?

View 2 Replies

Forms Data Controls :: Adding A Calculated Field To A Databound Control?

Oct 19, 2010

I'm using a gridview to extract a set of records. I need to add another field to the gridview, which can calculate the difference between a date associated with each record and the current date.

View 6 Replies

Forms Data Controls :: Display Label Based On Comparison Of Found Integer Data Fields

Feb 11, 2010

I am trying to reconstruct a date/time period from five data elements Year, StartMonth, StartDate, EndMonth, EndDate If the event starts on June 5 and ends on June 6, 2010 - The label would read June 5 thru 6, 2010. If the event starts on June 30 and ends on July 2, 2010 - the Label would read June 30 thru July 2, 2010. and if the event starts on June 5 and ends on June 5, 2010 - The label would read June 5, 2010. I've tried a few variations without success. This one comes closest to what I'm aiming for.

[Code]....

View 3 Replies

Forms Data Controls :: Dynamic DetailsView - Adding Template Field By Code?

Feb 11, 2010

I'm trying to add an DropDownList to a DetailsView by code, because i'm writing a solution that let's the user select an table and view your records and edit them, some of theese tables, have a foreign key column and the user must have to select some item in the list.

Below is my sample code:

[Code]....

the code above is working correctly, when the user click in the buttons New or Edit , the DetailsView opens correctly, showing the DropDownlist, but when the user click in the buttons update or insert , an error occurs, the viewState cannot be loaded:

Failed to load viewstate. The control tree which viewstate is being loaded must match the control tree used to save viewstate during the previous request. For example, when controls are added dynamically, the controls added during a post must match the type and position of the controls added during the initial request.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved