DataSource Controls :: Add Table Or Fields For Time Card Review?
Jan 21, 2010
I have time card data collected onto an AS400, and have an establed TimeReview.aspx which allows the user to review Time In/Out, etc. I have a request to add some way for managers to review the time and add corrections. I cannot edit direct or add fields to the time table in the AS400. I do, however, have a SQL Server that I could use to collect this information, but I'm not sure of the best way to go about it.
Here's an example of what the table should look like, with the added fields on the right. "X" (Revise) would be a checkbok indicating that this line should be revised. An administrative staff member would pull up the report the next day and manuall edit the time within the AS400.
-- From AS400 table -- -- SQL table --
Time Card info - Empl ID | WO | Date In | Time In | Date Out | Time Out | ---- X (Revise) | Corrected Time In | Correct Time Out
My thought is use an Empl ID field in the SQL table and bind it to the AS400 Empl ID field (not sure how).
View 3 Replies
Similar Messages:
Feb 9, 2010
I am using the SQLDataReader to execute a Stored Procedure that accepts two parameters (BuildingTID and Department) to return the appropritae Value in my case The Director of the Department. My problem is I get the following error when I run the code that I added below for review. Let me also add that the user is selecting the values that I am using for the stored procedure from 2 DropDownLists. I am getting it when I try to assign the value that is in the Department DropDown
list to the first parameter.
Dim myParm As SqlParameter = getDirectorsCMD.Parameters.Add("@BuildingTID", SqlDbType.Int, 15).Value = (ddlDepartment.SelectedValue)
Also obviously there are more issues with my code than just the error because the datareader records property is false meaning I am not returning a row
View 12 Replies
Jun 25, 2010
I am able to store the current time of day in a column defined as time with the C# code as:notestable.NoteTime = DateTime.Now.TimeOfDay;The hour, minutes, seconds, and even millionth of a second is stored. But now, I need to retrieve the time and convert it into a string. I tried to use DateTime statements to accomplish this as with:
DateTime nt = notestable.NoteTime;
String FirstT = nt.Hour.ToString() + ":" + nt.Minute.ToString().PadLeft(2, '0');
Regarding the 'nt' variable, I got an error message that said: Cannot implicitly convert type 'System.TimeSpan?' to 'System.DateTime'.Regarding the 'Hour' designation, I changed the definition of 'nt' to 'var' and got an error message that said: System.Nullible<System.TimeSpan>' does not contain a definition for 'Hour' and no extension method could be found.So, how do I access the time from a table and convert it into a string for display in a TextBox?
View 4 Replies
Aug 2, 2010
How can I update a table with current date and time using sqldatasource control?
View 2 Replies
Jun 1, 2010
My stored Procedure returns two tables say table1 and table2. When I try to fill the dataset, table1 is filling properly and table2 filling only one row of the table remaining rows coming empty. There is no error when I compile the code. And the output is an empty page.
Here the code I've used
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("TABL", cn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter dad = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
dad.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
View 5 Replies
Oct 20, 2010
This is the sqlDateTime overflow problem again. Background. As I'm sure you know dates must be between 1/1/1753 and 12/31/2999. If you have an empty date field, it throws and exception. So I created a function (below) that solve the problem when attempting to update or insert a record with a date field. Works great.
Public Shared Function MakeDateField(ByVal pasDate As String) As Nullable(Of DateTime)
If IsDate(pasDate) Then
Try
If pasDate <= System.DateTime.MinValue Then
Return Nothing
Else
Return CType(pasDate, DateTime)
End If
Catch ex As NullReferenceException
Return Nothing
End Try
Else
Return Nothing
End If
End Function
So I thought about using a time field. I have the field, have the validator in place and then attempted to test the page. It resulted in my least favorite error message "sqlDateTime overflow".
I can think of several workarounds like adding a date or a fixed date to the time field, or converting it to a string. Each of these is problematic.
IS THERE A BETTER WAY TO UPDATE/INSERT TIME FIELDS.
View 2 Replies
Jun 16, 2010
Iam using the Below Stored Procedure
[Code]....
and iam passing the Value to DepartmentName from code Behind but Stored Procedure is returning nothing.
while iam executing stored procedure in query Analyzer it return the value.
I debug the code and i passed the value to DepartmentName but i think iam not using WildCard Correctly.
View 5 Replies
Jul 6, 2010
In the table save your credit card.I want to encrypt all credit card information to be recorded in the database.
View 2 Replies
Oct 11, 2010
I've been working on this project which requires me to insert data into a database. Due to the complexities of the function that I am doing, it is more complex to use SqlDataSource and hence I've used the traditional method of inserting to the database. The codes are as follows:
[Code]....
I am not too sure why, but even though I've debugged numerous times and the data gets inserted into the database through the form view, I get this error on the page after everything is executed: Cannot insert the value NULL into column 'reviewDate', table 'ProrsumDB.dbo.Review'; column does not allow nulls. INSERT fails. The statement has been terminated. reviewDate wasn't null when I tried and there are no exception thrown.
View 13 Replies
Jun 3, 2010
my problem is that i have a gridview that fetch the data from database .I added the linkbutton on gridview that redirect to next page but cant working becouse at run time i add a bound field on gridview to calculate the time. source code
<asp:GridView ID="GridView3" runat="server" AllowPaging="True"
AutoGenerateColumns="False" CellPadding="4" Width="928px" Height="321px" OnPageIndexChanging="GridView3_PageIndexChanging" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" style="z-index: 102; left: 24px; position: absolute;
top: 248px" >
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<%--<asp:RadioButton ID="RadioButton1" onclick="javascript:CheckOtherIsCheckedByGVIDs(this);" runat="server" AutoPostBack="true" OnCheckedChanged="RadioButton1_CheckedChanged" />--%>
<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" CommandName="Select"
OnClick="LinkButton3_Click" Text="Update"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="id" HeaderText="Ticket Id" SortExpression="id" />
<asp:BoundField DataField="fname" HeaderText="Name" SortExpression="fname" />
<asp:BoundField DataField="phone" HeaderText="Phone No." SortExpression="phone" />
<asp:BoundField DataField="comname" HeaderText="Company Name" SortExpression="comname" />
<asp:BoundField DataField="sub" HeaderText="Subject" SortExpression="sub" />
<asp:BoundField DataField="mess" HeaderText="Message" SortExpression="mess" />
<asp:BoundField DataField="email" HeaderText="Email" SortExpression="email" />
<asp:BoundField DataField="status" HeaderText="Status" SortExpression="status" />
<asp:BoundField DataField="Dept" HeaderText="Dept" SortExpression="Dept" />
<asp:BoundField DataField="Prior" HeaderText="Priority" SortExpression="Priority" />
<asp:BoundField DataField="time" HeaderText="Time" SortExpression="Time" />
<-- <asp:BoundField DataField="Age" HeaderText="Age" SortExpression="Age" />--%>
<asp:TemplateField HeaderText="Detail">
<ItemTemplate>
<a href=# " onclick="return jsPop('Detail.aspx?id=<%#DataBinder.Eval (Container.DataItem,"id")%>', 'win01', 800, 500);">
view detail</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
</asp:GridView>
View 2 Replies
Apr 14, 2010
If I am going to use the asp.net membership and roles, the asp.net database includes an aspnet_Users table that has the userid and email address. If I have custom fields is it best practice to maintain a separate usert table and link on user id or to add fields to the aspnet_Users table?
View 1 Replies
Sep 16, 2010
I want to add controls (or simply texts) to a ListView inside the ItemTemplate at run time.
The reason is that in my application I don't know in advance how many controls (or texts) I should insert.
For example I have to read the fields from a database table and insert in the ItemTemplate controls according to those fields:
<ItemTemplate>
<%# Eval("fieldname1")%> - <%# Eval("fieldname2")%> - <%# Eval("fieldname3")%> - .....
Afterwards I have to bind the ListView to the table content, so I need to preserve the <%# ... %> structure for the binding
View 3 Replies
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
Jun 29, 2010
Have been trying to update some key fields but cannot get it working. I have the form working fine updating non key fields. I found some old threads on similar topics but none answering my question. I am using a FormView and a sqlDataSource
Question: What steps do I need to take to update key fields using a formview and a sqldatasource?
Additional Information: I have tried the following
Adding OldValuesParameterFormatString="old_{0}" to sqldatasource Adding to update parameters the old_myfield reference Adding DataKeyNames to the formview (note all key fields are in datakeynames and I only want to update the one)also when using the asp parameters do they need to be in same order as query and repeated as many time as used? Or just the same order as first referenced i.e. only defined once? Or any order?
View 6 Replies
Jan 20, 2011
I've been using the FilterExpression for the building of my GridView. I've built with this ability before, normally for searching for the name of an individual. However, the new project I'm working on has a small problem. I'm using an AND statement to filter the name via textbox and I'm also checking if the form was completely finished and if the form is reviewed via radio buttons.
Below is the code, but the problem is this. If any of the fields are blank (text field is left blank or the "both" is selected from the radio buttons) the form doesn't process my filter.
Is there an easy way to apply all three filters in a mix and match fashion (like no name, completed, not reviewed or any combination thereof)?
[Code]....
View 10 Replies
Apr 10, 2010
I was wondering if anyone knows of a good login stored procedure that can be freely used and features login limits and so on (basically a good one) With my limited SP knowledge, I've tried to create one myself, I haven't completed it yet as I'm not sure on how to compare the last login attempt time against the current time (it's in the comments).
P.S. I had to write this in notepad.
[Code]....
View 1 Replies
Jan 28, 2010
How do I check if my value is empty AND Isnull? I need to check for both, using ISNULL is not enough because the data can change just so that it is empty.
how I can change my query to accommodate this?
[Code]....
View 5 Replies
Mar 25, 2010
Is there a way to list on the fly all fields in object context? in entity framework?
for example in my Log (object context) i have fields LogId, Name, CreateDate
I would like to loop through these dynamically and assign values. This would be useful when my current context changes to another table I would be doing this:
[code]....
View 1 Replies
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
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
Jan 5, 2010
At first, I had my datalist being populated by my class 'PM' - I did it all inside the Page_Load event. Since there was a dataset being returned, I could assign different variables to fields in the Datatable, like:
[Code]....
Now, for reasons I won't go into here, I'm changing to an ObjectDataSource, using the same method to do the 'Select' of data... How can I do the same variable assigning, with the ObjectDataSource?
View 4 Replies
Jun 29, 2010
how can i select a record from A table and insert into B table using linq?
View 2 Replies
Jun 13, 2010
Basically i deal with two tables.i have a table T1 of the following format:id company_name i need to read this data and create a table T2 as followsi wrote the following code. it worked fine for retrieving data and modification but fails to insert the modified data into the 2nd table.the error is, it does not recognise the value for @token
ArrayList dynarr=new ArrayList(); // global variable
protected void Button2_Click(object sender, EventArgs e)
{
int row = 1; int i;
string strcmd = null;
string Connection = "Data Source=....";
SqlConnection conn = new SqlConnection(Connection);
string str = "select company_name from T1 where ID=@ID";
[code]...
View 2 Replies
May 11, 2010
I'm trying to set the "time" value stored in a date time field, in other words, I want to change the value
05-13-2010 08.47.34
to
05-13-2010 00.00.00
or
05-13-2010 23.59.59
What statement would I use to accomplish this?
View 4 Replies
Jun 9, 2010
I have two tables - Student and Advert.
I want to do the following;
1. Student is logged into their account (session is authenticated)
2. StudentID is primary key for that table, it is a foreign key for table Advert
3. When student is logged in, they create advert
What I want is their student Id to be input into the advert table when this new advert is created. How is this possible?
View 1 Replies