Search Results

Search found 279 results on 12 pages for 'soo wei tan'.

Page 6/12 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • C# LINQ join With Just One Row

    - by Soo
    I'm trying to make a query that grabs a single row from an SQL database and updates it. TableA AId AValue TableB BId AId BValue Ok, so TableA and TableB are linked by AId. I want to select a row in TableB based on AValue using a join. The following query is what I have and only grabs a value from TableB based on AId, I just don't know how to grab a row from TableB using AValue. I know you would need to use a join, but I'm not sure how to accomplish that. var row = DbObject.TableB.Single(x => x.AId == 1) row.BValue = 1; DbObject.SubmitChanges();

    Read the article

  • Grabbing Just The Top Entry From A LINQ Query

    - by Soo
    I basically have a lot of poorly designed code to do something that, I'm sure, can be done far more elegantly. What I'm trying to do is grab the last date from a database table. var Result = from a in DB.Table orderby a.Date descending select new {Date = a}; foreach(var Row in Result) { LastDate = Row.Date.Date; break; } Basically, there's a foreach loop that is designed to run only once. Crappy code! What's a "best practice" way to accomplish the same thing?

    Read the article

  • Repeating random variables in VBA

    - by Soo
    How can I use randomize and rnd to get a repeating list of random variables? By repeating list, I mean if you run a loop to get 10 random numbers, each random number in the list will be unique. In addition, if you were to run this sequence again, you would get the same 10 random numbers as before.

    Read the article

  • When Something Occurs in a BackgroundWorker, Trigger Code on a Different Thread?

    - by Soo
    I have a background worker that runs and looks for stuff, and when it finds stuff, I want to update my main WinForm. The issue that I'm having is that when I try to update my WinForm from my background worker, I get errors that tell me I can't modify things that were made outside of my background worker (in other words, everything in my form). Can someone provide a simple code example of how I can get my code to work the way I want it to? Thanks!

    Read the article

  • C# Looping A Process Over And Over Until A User Presses A Key

    - by Soo
    I have a schedule checker that needs to run until a user presses a key to make it stop. My thoughts on doing this are as follows: The user starts the process Process runs every 10 seconds When the process is not running, Console.ReadLine(); gives the user the option to press "q" to stop the process My approach would work fine except the user would have to wait however long the process takes to complete before being able to stop it. Is there any way to simultaneously run the process while being able to take a user input?

    Read the article

  • Rerunning DoWork on Background Worker Based on Result?

    - by Soo
    Let's say I have a backgroundWorker1_DoWork that finds a value in a database and returns it in e.Result. Let's say I also have a backgroundWorker1_RunWorkerCompleted that reads the result. What I want to be able to do is based on e.Result, I can re-run backgroundWorker1_DoWork, and this I am not sure how to do. I'd really appreciate any help.

    Read the article

  • SSIS - user variable used in derived column transform is not available - in some cases

    - by soo
    Unfortunately I don't have a repro for my issue, but I thought I would try to describe it in case it sounds familiar to someone... I am using SSIS 2005, SP2. My package has a package-scope user variable - let's call it user_var first step in the control flow is an Execute SQL task which runs a stored procedure. All that SP does is insert a record in a SQL table (with an identity column) and then go back and get the max ID value. The Execute SQL task saves this output into user_var the control flow then has a Data Flow Task - it goes and gets some source data, has a derived column which sets a column called run_id to user_var - and saves the data to a SQL destination In most cases (this template is used for many packages, running every day) this all works great. All of the destination records created get set with a correct run_id. However, in some cases, there is a set of the destination data that does not get run_id equal to user_var, but instead gets a value of 0 (0 is the default value for user_var). I have 2 instances where this has happened, but I can't make it happen. In both cases, it was just less that 10,000 records that have run_id = 0. Since SSIS writes data out in 10,000 record blocks, this really makes me think that, for the first set of data written out, user_var was not yet set. Then, after that first block, for the rest of the data, run_id is set to a correct value. But control passed on to my data flow from the Execute SQL task - it would have seemed reasonable to me that it wouldn't go on until the SP has completed and user_var is set. Maybe it just runs the SP, but doesn't wait for it to complete? In both cases where this has happened there seemed to be a few packages hitting the table to get a new user_var at about the same time. And in both cases lots of data was written (40 million rows, 60 million rows) - my thinking is that that means the writes were happening for a while. Sorry to be both long-winded AND vague. A winning combination! Does this sound familiar to anyone? Thanks.

    Read the article

  • Adding A New Row Using SQL Server Management Studio

    - by Soo
    I'm learning how to use SQL Server Management Studio and can't figure out how to insert a new row into a table. Table Structure: ID, Field1, Field2 Query: INSERT INTO Table (Field1,Field2) VALUES(1,2) Error: Major Error 0x80040E14, Minor Error 25503 I'm probably missing something very noobie like. Any help would be appreciated.

    Read the article

  • Referencing An Object From ThisWorkbook

    - by Soo
    I need to populate several comboboxes in an Excel sheet upon loading it. I have the Workbook_Open() event set up on my ThisWorkbook code sheet in my VBA Editor. Now that the code isn't in my Sheet1 code sheet in my VBA Editor, the following code doesn't work: ComboBox.AddItem "hulkSMAASH!" How can I reference this combobox from my ThisWorkbook code sheet in my VBA Editor?

    Read the article

  • Adding Items To A Combo Box Without Code?

    - by Soo
    I want some default values in my combo boxes but can't seem to figure out how to do this without writing a module that populates the combo boxes. How can I manually fill in the combo boxes so I don't have to use code to do something so simple. Thanks

    Read the article

  • Proper Form Application Design

    - by Soo
    I'm creating a WinForm application in C# and one of its functions is displaying text in text boxes. I'm coding the logic for querying a database in a separate class and am unable to access the text box element in the class I'm creating (I'm getting a "name" does not exist in the current context error). Do I put all of my form logic into my Form1.cs file?

    Read the article

  • C# Creating A Program That Runs In The Background?

    - by Soo
    How can I create a program that runs in the background, and can be accessed via the Windows' "Notification Area" (Where the date and time are in the lower right hand corner)? In other words, I want to be able to create a program that runs and can toggle between having a display window and not having a display window.

    Read the article

  • WinForm And Looping

    - by Soo
    I have a WinForm set up and a process that loops until a button is pressed on the form. When I try to run my code, the form does not even display. I suspect this is because the code gets stuck in the loop and doesn't get far enough to display the WinForm. How can I get the form to display and the loop to run after that point?

    Read the article

  • Database Design Question

    - by Soo
    Ok SO, I have a user table and want to define groups of users together. The best solution I have for this is to create three database tables as follows: UserTable user_id user_name UserGroupLink group_id member_id GroupInfo group_id group_name This method keeps the member and group information separate. This is just my way of thinking. Is there a better way to do this? Also, what is a good naming convention for tables that link two other tables?

    Read the article

  • When To Use this.method()?

    - by Soo
    Hi SO, and happy Friday I have a question regarding the use of this.method();. My code seems to work without using the this., but I include it because it seems like the right thing to do. When should .this be used, and because it's presence doesn't always make a difference, what's the best practice for .this?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12  | Next Page >