Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Member
    Join Date
    Aug 2011
    Posts
    71
    Member #
    28914
    Liked
    1 times
    This is in c#, but any sql knowledge will help:
    I am taking an ID and a Password by way of form. I have two tables. One of my tables has the ID, Password, Last name, First name. My other table will basically be a timesheet that will have the last name, first name, in/out, and time.

    It will be an employee clock system. I want the employer to get a table at the end of the day with names, time, etc. I need to take the user ID/Password from the form, select there name from my Admin table based on the ID/Password and place the name/time into my Emp_Clock_In table.



    da.InsertCommand = new SqlCeCommand("UPDATE Emp_Clock_In SET Last = (SELECT Last FROM Admin WHERE Admin.Password = @PASSWORD),"
    + "SET First = (SELECT First FROM Admin WHERE Admin.Password = @PASSWORD), SET Time = @TIME, SET In_Out = @INOUT", cn);


    da.InsertCommand.Parameters.Add("@ID", SqlDbType.NVarChar).Value = a;
    da.InsertCommand.Parameters.Add("@PASSWORD", SqlDbType.NVarChar).Value = b;
    da.InsertCommand.Parameters.Add("@TIME", SqlDbType.NVarChar).Value = c;
    da.InsertCommand.Parameters.Add("@INOUT", SqlDbType.NVarChar).Value = inout;
    cn.Open();
    da.InsertCommand.ExecuteNonQuery();
    cn.Close();



    I have tried all kinds of things, and the code above is an update line. That is because I was trying a last resort. I have also tried separate select statements planning to use executeScaler for a string. Had issues there.

    Keep in mind, I need to INSERT. If an employee clocks in, they will be placed in a field with the time. If they clock out, they will be placed AGAIN. Thanks

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:12 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com