Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

ruanr

@ruanr
About
Posts
57
Topics
23
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Managing tabs in a multiline tab control
    R ruanr

    Hi all, I have a tabcontrol with a lot of tabs which may be added and removed dynamically. I'm using a multiline tab control due to the amount of tabs involved, and I would like to simple be able to add a tab to either the top or bottom row of tabs programatically. Is that at all possible? Thanks..

    Windows Forms question

  • MVP/MVC/Decoupled architecture VS modern databound controls
    R ruanr

    Hi.. Modern day application design seems to always lean towards a decoupled architecture: you have a dumb view, which is independent of your data model. This makes sense as it allows you to reuse the controller/model independently from the view. Seemingly contradicting this is modern controls which seem to lean more and more towards databound designs. How do we reconcile this kind of architecture with the controls at our disposal? For example, I am creating an application following a Passive View MVP architecture that, at some point, will have to manipulate items in a grid, and the grid works best if it is directly databound to the database. Am I using the wrong design architecture? Or should I be super-abstracting my data? (Database -> Dataset -> Classes -> Dataset -> View) :confused: Design patterns always sound so good in theory... :)

    Design and Architecture architecture css asp-net database visual-studio

  • Dataset/DataAdapter and updating changes to the database..
    R ruanr

    I may have found a solution - naming the tables directly after calling Fill SEEMS to help. I always get these revelations just after posting....

    .NET (Core and Framework) help database question tutorial announcement

  • Dataset/DataAdapter and updating changes to the database..
    R ruanr

    Hi. I'm quite new to using DataSets/DataAdapters. At first, I tried to populate my DataSet (which consists of several tables) with one select query, like so:

    var cmd =
    new SqlCommand("SELECT * FROM TableOne;SELECT * FROM TableTwo", con);
    myDataAdapter= new SqlDataAdapter(cmd);

                    myDataAdapter.Fill(ds);
    

    I then proceed to set the primary key for TableTwo in the dataset and instantiate a SqlCommandBuilder with the Adapter as parameter. When I eventually call myDataAdapter.Update(ds.Tables["TableTwo"]); the adapter gets confused and complains that it can't find a column from TableOne in TableTwo. I googled around and read that you can fix this problem by using seperate DataAdapters for each table in the DataSet. I tried this, creating a new SqlCommand for each adapter with only one select query in each, but calling the second myDataAdapter.Fill overwrites the contents of the DataSet completely! Of course I could use seperate DataSets for each table but that seems like the incorrect solution. I've googled for tutorials and examples but all of them are too simple to help me (never more than 1 table in the DataSet, and some other issues as well). Basically, I'd appreciate some advice on how to approach this problem - is it doable with one DataAdapter? if so, how do I get the DataAdapter to understand my DataSet (which seems to be the problem here..)? Otherwise, how do I use more than one DataAdapter to populate a single DataSet? Thanks in advance for any help...

    .NET (Core and Framework) help database question tutorial announcement

  • Using Extended stored proc's within functions / dynamic SQL
    R ruanr

    Hello... I'm using T-SQL. What I'm trying to do is (within a function) read a value from a specified dynamic column, and return that value for usage elsewhere. The following lines would do the trick: [code] SET @SqlString = 'SELECT @Value = [' +@ColumnName +'] FROM SettingTable WHERE ID = 50' exec sp_executeSql @SqlString,N'@Value int OUTPUT', @Value OUTPUT [/code] However, I can't use that within a function (Only functions and extended stored procedures can be executed from within a function), even though sp_help tells me that sp_executeSql is an extended stored procedure. Is there some way I should be calling the executesql proc that would allow it? Or is there another way I should be generating my dynamic query that would be allowed within a function, and which will allow me to get an output value from the query?

    Database database sharepoint question

  • Connection Pooling problem
    R ruanr

    I did check the connections to the server with sp_who and by reading from sysprocesses, there are no connections open with his username when he is not actively using our system, and even when he is, there are 5 or less (with a max pool size of 100) Is there a more efficient way of monitoring database connections?

    .NET (Core and Framework) help csharp database question

  • Connection Pooling problem
    R ruanr

    That does seem to be the case. Oddly enough with a different username he gets another error (Named Pipe Error 40), but it boils down to a connection not establishing. I'm going to try to get him to set his DSN to use TCP rather than Named Pipes, but this is basically clutching at straws.

    .NET (Core and Framework) help csharp database question

  • Connection Pooling problem
    R ruanr

    Hi... I have a problem and quite frankly I'm stumped :| One of our clients is repeatedly getting the "Timeout expired. the timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached." The common cause of this error is ofcourse the connection pool being exhausted, but this seems extremely unlikely - the connection keeps the default max pool count (of 100?), and the client has been unable to use this specific application since day 1. Secondly, the timeout on my connection is set to 120, but the client receives the dialog ~20 seconds after attempting to start the application. The client is also able to start the application from another computer, using the same login (which should lead to the same connection string, and hence the same connection pool). The client is able to connect to the database using other (non .net) applications on his system. I have asked him to try and start other .net apps that connect to the database in a similar fashion as mine, unfortunately the client is Chinese, and not technically minded, which makes communication very hard. Basically, I'm just looking for ideas for a line of investigation. Anyone have a clue?

    .NET (Core and Framework) help csharp database question

  • Query Optimization
    R ruanr

    Hi all.. To keep it short - We automatically update a set of tables (lets call it the DATA tables) in a client's database by dumping the raw data into a table (DUMP table) which has in INSERT trigger on it, which will then go and update the various data tables. I'm extending this functionality by adding a SETTING table which will allow clients to specify which fields they want updated. The SETTING table has two fields, an ID for each field in the DATA tables, and a setting field, which can be 0 for never update, 1 for always update, and 2 for only update if the corresponding field is null in the data table. Some people might complain that this is horrible design - There are reasons for it. My problem lies with optimization of this query. I get 30000 rows (bout 30-40 columns) at a time in the dump table and the trigger runs for about 40 minutes if it updates blindly, but now I need two extra SELECTs per field - first to check the update setting, then to check if the value is NULL should the setting be 2. So this comes down to more or less (ignore syntax trivialities): SELECT @setting = UpdateSetting FROM Setting WHERE ID = @fieldid IF @setting = 1 OR (@setting = 2 AND IS NULL (SELECT field FROM Data WHERE id = @rowID) UPDATE Data SET Field = @newfieldval WHERE ID = @rowID Obviously this query will take AGES to complete, compared to the previous: UPDATE Data SET field1 = @newField1Val, field2 = @newField2Val, [etc] ... WHERE id = @rowID How should I go about optimising this? I am still somewhat novice when it comes to SQL. So far I'm considering building up an update string per row, which should at least cut down the number of updates significantly, but the number of extra selects are still a problem. Ideas? Clarifications needed? Thanks in advance.

    Database database css design algorithms performance

  • SQL trigger fun
    R ruanr

    Oh - I am a bit of a SQL novice, did not realize that 'select * into' will create a table. If that is the case, why is the 'ELSE' clause necessary? And yes, Task got some extra col's, and so caused problems.

    The Weird and The Wonderful database question announcement

  • SQL trigger fun
    R ruanr

    CREATE TRIGGER tmTaskChangeHist ON Task FOR UPDATE, INSERT NOT FOR REPLICATION
    as
    begin
    set nocount on
    if not exists (select * from sysobjects where name = 'TaskChangeHist')
    select * into TaskChangeHist from inserted

    else
    insert TaskChangeHist select * from inserted
    set nocount off
    end

    Oh my. On top of this we have strict annotation guidelines at my company, which weren't followed there (note lack of comments :P) Can someone please explain the thought process of checking whether TaskChangeHist exists, and then inserting anyway? (not to mention the use of select *, although i guess it could be justified in this context)

    The Weird and The Wonderful database question announcement

  • Follow up to Pete's thread below
    R ruanr

    Why not go to those petrol stations then? I have to agree with the previous poster who said that getting a few litres of petrol at a high price is worth alot more than not being able to get any at a lower price.

    The Back Room question announcement

  • Follow up to Pete's thread below
    R ruanr

    Allow me to introduce you to the market forces of 'Supply and Demand'.

    The Back Room question announcement

  • Stress, booze and more stress
    R ruanr

    I recommend: pot!

    The Lounge com tools json question

  • Complex SQL query... [modified]
    R ruanr

    okay, see edit..

    Database database question announcement

  • Complex SQL query... [modified]
    R ruanr

    SQL novice here.. Hi, I'm having trouble formulating an SQL query and tbh I'm not even sure if its possible to do what I'm trying to do [without a cursor]. I have two tables with a standard 1->M relationship. If a certain field in ALL the linked records are set to a certain value, I need to update a field in the parent record, if the field is set to a different value in one of the linked records, i do nothing. How should I phrase the query? Edit for clarification: Lets say it is a Client table, with a related Tasks table, and the intermediate ClientTasks table. If all the Tasks related to a Client are marked as done, I need to update a field in the Client's record to mark the client as having no outstanding tasks. Thanks in advance..

    modified on Tuesday, June 17, 2008 4:26 AM

    Database database question announcement

  • MSSQL: removing semi-duplicate entries
    R ruanr

    Hi, I have a table (call it Part) listing our products and their prices. Prices change every once in a while and my boss made a new entry for each product every time its price changed. A simplified illustration: ID Name PriceEffectiveDate Price ---- ---- -------------------- ----- 1 Shoe 1-1-2006 $1 2 Glove 1-1-2006 $2 ... 41 Shoe 1-1-2007 $2 (etc) (I should mention there is no priceEffectivedate column, he used a col that was intended for something else!) Obviously this is horrible design, so I created a second table (PartPrice) with columns partID,Price,and EffectiveDate. Now I need to remove the later entries for each product, but keep the original ones, and make the corresponding entries in the PartPrice table... I'm not an experienced SQL developer, anyone have any ideas? There are two things to make the problem simpler: Every part has a unique name, and the amount of parts have stayed constant, so each part has its entries a constant amount apart (i.e. Shoe will have ID's 1, 41, 81; glove will have 2,42,82 etc) Any hints/tips/ideas?

    Database database sql-server design help question

  • MSSQL: Finding out column names for a table
    R ruanr

    Nevermind: select * from information_schema.columns where table_name = 'yourtablenamehere'

    Database database sql-server

  • MSSQL: Finding out column names for a table
    R ruanr

    Hi, I need a select query to get the column names of a table in the database.. basically, what I'm trying to do is: IF NOT EXISTS (SELECT * FROM TableColumns WHERE Column = 'missingcolumn' AND Table = 'Tab') ALTER TABLE Tab ADD missingcolumn [...] I just need the correct select query. Thanks :)

    Database database sql-server

  • Using resource strings
    R ruanr

    Hi, I have to keep all my labels for controls in a resource file to ensure easier translation of the program. How do I set a button's text to what is contained in a resource file, from the form designer? It's easy to set it in code but I'm sure there is a way to set it directly from the designer? Thanks...

    C# question learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups