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
A

alex3_14

@alex3_14
About
Posts
8
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Odd problem (conversion or openquery?) only appearing in a stored procedure but not when running it adhoc
    A alex3_14

    I went one higher and did the following:

    print '------right before the select-----------'
    --2009
    --Nov 14 2008 12:00AM
    SELECT --line 67--
    LTRIM(RTRIM(T_ASFSTAG0.STANS1)),
    LTRIM(RTRIM(T_ASFSTAG0.STHFO1)), LTRIM(RTRIM(T_ASFSTAG0.STRSP1))
    FROM T_ASFSTAG0
    /* WHERE (T_ASFSTAG0.STANS1=@AnneeSelectionnee) AND
    ((isdate(T_ASFSTAG0.STCRT1)=1 and (convert(datetime,convert(varchar,T_ASFSTAG0.STCRT1))>=convert(datetime,convert(varchar,@DateDernierImport,103),103))) or
    (isdate(T_ASFSTAG0.STMAJ1)=1 and (convert(datetime,convert(varchar,T_ASFSTAG0.STMAJ1))>=convert(datetime,convert(varchar,@DateDernierImport,103),103))))
    */print '------after the select and before the insert-----------'

    Essentially, it's just the referencing of the view that makes it fail. By the way, the view is defined with specific fields...

    SELECT STANS1, STSTA1--,... snip many others
    FROM OPENQUERY(ISERIES_SQLDBF, 'SELECT * FROM tstadvdbf.ASFSTAG0') AS DerivedTable1

    The error I got was:

    Server: Msg 7399, Level 16, State 1, Procedure P_IMPORT_STAGES_PREPA, Line 67
    OLE DB provider 'MSDASQL' reported an error. One or more arguments were reported invalid by the provider.
    OLE DB error trace [OLE/DB Provider 'MSDASQL' ITransactionJoin::JoinTransaction returned 0x80070057: One or more arguments were reported invalid by the provider.].

    Alex

    Database database help csharp com sysadmin

  • Odd problem (conversion or openquery?) only appearing in a stored procedure but not when running it adhoc
    A alex3_14

    Here's the code I can run with no problems:

    declare @AnneeSelectionnee numeric
    select @AnneeSelectionnee = 2009
    declare @DateDernierImport datetime
    select @DateDernierImport = 'Nov 14 2008 12:00AM'

    SELECT
    LTRIM(RTRIM(T_ASFSTAG0.STANS1)),
    LTRIM(RTRIM(T_ASFSTAG0.STHFO1)), LTRIM(RTRIM(T_ASFSTAG0.STRSP1))
    FROM T_ASFSTAG0
    WHERE (T_ASFSTAG0.STANS1=@AnneeSelectionnee) AND
    ((isdate(T_ASFSTAG0.STCRT1)=1 and convert(datetime,convert(varchar,T_ASFSTAG0.STCRT1,103),103)>=convert(datetime,convert(varchar,@DateDernierImport,103),103)) or
    (isdate(T_ASFSTAG0.STMAJ1)=1 and convert(datetime,convert(varchar,T_ASFSTAG0.STMAJ1,103),103)>=convert(datetime,convert(varchar,@DateDernierImport,103),103)))

    Please note that T_ASFSTAG0 is a view that is partly defined as follows:

    FROM OPENQUERY(ISERIES_SQLDBF, 'SELECT * FROM tstadvdbf.ASFSTAG0') AS DerivedTable1

    And the following is the relevant code from the stored procedure that fails:

    print @AnneeSelectionnee--2009
    print @DateDernierImport--Nov 14 2008 12:00AM

    print '------before the select-----------'
    print convert(datetime,convert(varchar,@DateDernierImport,103),103)
    print '------right before the select-----------'

    SELECT --line 60--
    LTRIM(RTRIM(T_ASFSTAG0.STANS1)),
    LTRIM(RTRIM(T_ASFSTAG0.STHFO1)), LTRIM(RTRIM(T_ASFSTAG0.STRSP1))
    FROM T_ASFSTAG0
    WHERE (T_ASFSTAG0.STANS1=@AnneeSelectionnee) AND
    ((isdate(T_ASFSTAG0.STCRT1)=1 and convert(datetime,convert(varchar,T_ASFSTAG0.STCRT1,103),103)>=convert(datetime,convert(varchar,@DateDernierImport,103),103)) or
    (isdate(T_ASFSTAG0.STMAJ1)=1 and convert(datetime,convert(varchar,T_ASFSTAG0.STMAJ1,103),103)>=convert(datetime,convert(varchar,@DateDernierImport,103),103)))

    print '------after the select and before the insert-----------'

    That select statement (on "line 60") reports an error. We never see the "after the select and before the insert" print message. I thought it might have been a conversion problem but as long as an AND statement works like && does in C# (and, AFAIK, it does) then we should have no problems with the (isdate(x) AND convert(datetime(x)). This is the error I receive:

    Server: Msg 7399, Level 16, State 1, Procedure P_IMPORT_STAGES_PREPA, Line 60
    OLE DB provider 'MSDASQL' reported an error. One or more arguments were reported invalid by the provider.
    OLE DB error trace [OLE/DB Provider 'MSDASQL' ITransactionJoin::JoinTransaction returned 0x800700

    Database database help csharp com sysadmin

  • Standard pattern for updating a tab in one click?
    A alex3_14

    I think I'll be able to figure it out from there - thanks for all the help.

    Alex

    ASP.NET question csharp javascript asp-net database

  • Standard pattern for updating a tab in one click?
    A alex3_14

    Well, in this case, the problem is that I click the button and... 1. The tab, I want updated, gets updated with old information thanks to obsolete session variables and whatnot. 2. The C# code executes - changing the session variables to the values I need (the values being decided by which GridView row the user selected and/or by querying the db). Result: A tab with old information. What would I need to do to recover the correct values I need and then update the tab with one click/selection?

    Alex

    ASP.NET question csharp javascript asp-net database

  • Standard pattern for updating a tab in one click?
    A alex3_14

    That's my question: How *do* I rearrange my code to fit the desired result? Or, is there some AJAXy thing I can do to the button that will allow code to run first and then load a control? (I should have mentioned that I have looked at the page lifecycle and I still have no idea how to accomplish what I need. My workaround so far has been requiring a selection of an item (datagrid selection, dropdown selection, etc.) and then a button click to confirm the selection.)

    Alex

    ASP.NET question csharp javascript asp-net database

  • Standard pattern for updating a tab in one click?
    A alex3_14

    OK, I'm fairly green with ASP.net and I keep running into the same problem and I've solved it in various ways but none to my satisfaction. What I want: - To be able to click on a button/link or choose an option from a dropdownlist and have a tab be updated immediately with data supplied by the event set off by the button/link/dropdown. What I can do so far: - First click updates the tab and *then* sets the necessary variables that my tab needs to update properly. A second click re-updates the tab correctly. So, I use the OnClick event (or similar) of the button to set Session variables (values of which may come from a db) that the tab's OnLoad event needs to load itself properly. Unfortunately, the OnLoad of the tab happens before the OnClick of the button. Question: - What is the standard, non-javascript, way of making a C# function happen before the button engages the OnLoad event? Preferably I'd like the OnLoad to only happen once, but if the only way is for the thing to be set off twice, I can live with that. :)

    Alex

    ASP.NET question csharp javascript asp-net database

  • Another DB design question:
    A alex3_14

    If I had three tables (the 3T) called Building, Floor, and Room (the data is what you'd probably expect) and I wanted to be able to manage inactive periods (or permanent shut-downs) of any one record in any of those tables, what would be the best way to do it? My first thought (which doesn't seem elegant) was to create an inactiveId field in the 3T, referencing an Inactive table which would store the beginDate, endDate (if any), and inactivityReason. Now consider a floor is scheduled to undergo renovations from January 10th to February 10th and one of the rooms of that same floor is scheduled for a permanent installation of WiFi and AC outlets for every desk from January 2nd to January 29th. Should I store the fields buildingId, floorId, and roomId in the Inactive table or is the inactiveId in the 3T enough? Should I create a trigger (or a scheduled function) to remove any "expired" inactiveId from the 3T (i.e. the affected room would have a null inactiveId on January 30th and the affected floor would follow suit on February 11th)? If the above is completely wrongheaded, please let me know. I'm not a dba, just a lowly programmer. And, since I want to design it to be easy to use for future programmers, I don't need everything to be strictly normalized if there's a usability payoff for the end user (although my instincts are to usually go up to 3NF and 2NF).

    Alex

    Database database question design

  • MaskedTextBox + KeyEventArgs.SuppressKeyPress = bug?
    A alex3_14

    My MaskedTextBox seems to have a bug in combination with the following function which gets called within the KeyDown event for all my TextBoxes: private void dataEntryBehaviour(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Down) { // e.KeyCode = Keys.Down; //to avoid the 1st input character disappearing bug //NOT ALLOWED - READ ONLY! //SuppressKeyPress is used to keep ENTER from being heard e.SuppressKeyPress = true; //this also sets e.Handled to true this.SelectNextControl((Control)sender, true, true, true, true); } else if (e.KeyCode == Keys.Up) { e.SuppressKeyPress = true; //this also sets e.Handled to true this.SelectNextControl((Control)sender, false, true, true, true); } } The error is the following: After the user finishes entering the data, they can click a button to add the data into the database. The form then calls ResetText() on all the TextBoxes and the data entry begins anew. And here is where weird things happen: The first character typed into the MaskedTextBox disappears immediately after the second character input is typed (leaving a space behind). Also weird: If I don't set MaskedTextBox.SelectionStart = 1, the first character typed appears before what the Mask should allow ("(000) 000-0000"). Note that even if I set MaskedTextBox.SelectionStart = 1, which will display the first character to appear after the "(" literal, it'll still disappear after the second character is typed. Attempting to type "3056667777" results: Without setting MaskedTextBox.SelectionStart = 1, "(056) 667-777_" With setting MaskedTextBox.SelectionStart = 1, "(_05) 666-7777" So, essentially, to get the results I want I'd have to not set MaskedTextBox.SelectionStart = 1, and type "33056667777". Now, this error only occurs on in my MaskedTextBoxes (not my vanilla TextBoxes) and only when ENTER is pressed to navigate away from that particular control. Also, if I use KeyEventArgs.Handled instead KeyEventArgs.SuppressKeyPress - the problem disappears. Unfortunately, I then get a "Windows XP Ding" every time I hit ENTER. What am I doing wrong or is this just a bug with MS' new control?

    Alex

    .NET (Core and Framework) help database question
  • Login

  • Don't have an account? Register

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