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
L

LordZoster

@LordZoster
About
Posts
60
Topics
24
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • synchronizing xml and database
    L LordZoster

    Schematically, I'm dealing with two datasets with the same schema: they have 5 tables. I need to synchronize the two dataset, being Dataset A the source (XML from webservice) and Dataset B the destination (the database).

    C# database sql-server cryptography xml question

  • synchronizing xml and database
    L LordZoster

    I'm going for the Dataset.Merge(DataSet) method, as in http://msdn.microsoft.com/it-it/library/4swwh51k(v=vs.80).aspx[^] But I would still like to know your opinion, since I hate dealing with recordsets within a code: databases are born to deal with recordsets, and I'm a db guy :)

    C# database sql-server cryptography xml question

  • synchronizing xml and database
    L LordZoster

    Hallo I'm consuming a webservice returning an XML with 5 nested complexType (i.e. 5 relationed tables); I should write those data into corresponding tables in a mssql db, updating or inserting when needed. Do DataAdapters provide such functionality? Actually, the Update method synchronizes a dataset and its original data source. What if the dataset comes from a different datasource? Update uses the RowState property to determine the kind of SQL command to be issued: in my case I should need something like an hash comparison (checksum) between each row in the source dataset and each row in the target db, for each table. I'm considering to transfer to the db the whole process of hashing and comparing. Could you give me your advice? Thanks in advance

    C# database sql-server cryptography xml question

  • xml to dataset to database
    L LordZoster

    Hallo I'm consuming a webservice returning a XML with multiple nested complexType. Using DataSet.ReadXML method I transform it in a dataset with tables and relationships. I created a database with tables corresponding to the dataset. How could I insert/update data from the dataset into the database? I mean, how could I map the tables between the ds and the db? Some rows could need an update instead than an insert. Thanks in advance

    C# database xml question announcement

  • Default datetime.now in datatable and bound datagridview
    L LordZoster

    The BindingSource is supposed to handle this conversion by itself, doesn't it? And, in case I overrun this conversion writing my own one, where should I write it? From what I understand (very little, I admit) I should overrun a whole lot of stuff of BindingSource: in this I totally agree with Andy_J, it is preferrable to use one's own DAL. The worst thing is, that datetime cell is readonly, so there's no need to write it back into the database from the datagridview hence no need to convert any string...

    C# database help question

  • Default datetime.now in datatable and bound datagridview
    L LordZoster

    I'm giving up, it's quite a nightmare if the system itself doesn't understand values it automatically wrote.

    C# database help question

  • Default datetime.now in datatable and bound datagridview
    L LordZoster

    thanks it doesn't work. I'll try dgv.autogeneratecolumns = false and so on.

    C# database help question

  • Default datetime.now in datatable and bound datagridview
    L LordZoster

    Hallo paramu, thank for the reply. The datatable.locale is used by Microsft in many examples, I kept it for preventing any issue from handling italian characters like accents, and for datetime handling too. I tried your code but it didn't work, neither with "en-GB" nor with "it-IT". It sounds that this is happening: 1. the default value in datatable is correct 2. the datagridview format it as string 3. when saving, the system fails to handle the string. I would like to try to explicitly type the datetime column, but this would require me to manually code each column of the DGV. Ubi maior, minor cessat... I'll give it a try.

    C# database help question

  • Default datetime.now in datatable and bound datagridview
    L LordZoster

    Hallo the DGV is a plain one, is bound to a BindingSource which has is DataSource property set to the DataTable. No modification is made on the fields type: the field holding the datetime is a default DataGridViewCell, automatically created at binding. You're giving me an interesting hint... By the way I hope that I should not create manually each column in the DataGridView to have it right typed .

    C# database help question

  • Default datetime.now in datatable and bound datagridview
    L LordZoster

    Hallo my application sports a dgv bound to a datatable, which has a column with default value to DateTime.Now. When the user add a new row, that datetime column is correctly filled; when the user saves for the first time, it correctly saves. Any next time the user try saving the row, it gives a System.FormatException "String not recognized as valid DateTime value", and stops saving. The DateTime in the DGV appears to be formatted according the locale Culture (italian, dd/MM/yyyy hh.mm) The DataTable.Locale is System.Globalization.CultureInfo.InvariantCulture. If I change it to System.Globalization.CultureInfo.CurrentCulture i get an obscure exception "Found unknown word starting at index 0". Any help? Thanks in advance!

    C# database help question

  • use same ContextMenu for different datagridviews
    L LordZoster

    Solved.

    private void eliminaToolStripMenuItem\_Click(object sender, EventArgs e)
    {
      ToolStripDropDownItem menu = (ToolStripDropDownItem)sender;
      ContextMenuStrip strip = (ContextMenuStrip)menu.Owner;
      Control owner = strip.SourceControl;
      DataGridView dgv = (DataGridView)owner;
        if (dgv.CurrentRow.Index > -1)
          dgv.Rows.Remove(dgv.CurrentRow);
    }
    
    C# question

  • use same ContextMenu for different datagridviews
    L LordZoster

    Thanks for replying, actually I get an exception of "casting a ToolStripItem type on DataGridView type".

    private void deleteToolStripMenuItem\_Click(object sender, EventArgs e)
    {
      DataGridView dgv = (DataGridView)sender;
      if (dgv.CurrentRow.Index > -1)
        dgv.Rows.Remove(dgv.CurrentRow);
    }
    

    modified on Friday, March 18, 2011 6:08 AM

    C# question

  • use same ContextMenu for different datagridviews
    L LordZoster

    Hallo I put several dgv's in a form, and I created a ContextMenuStrip to perform same common operations on dgv's "CurrentRow" record (eg. Deletion). Is there any way I could reuse the same ContextMenuStrip without duplicating, maybe passing the dgv object as an argument? I would avoid to rewrite a control that inherits and extends ContextMenuStrip. Thanks in advance

    C# question

  • form controls default values
    L LordZoster

    you're welcome. For completeness sake, I'm posting a snippet about it:

    void defValues(DataTable dt)
    {
      foreach (DataColumn dc in dt.Columns)
      {
        switch (dc.DataType.ToString())
        {
          case "System.DateTime": //datetime
            dc.DefaultValue = DEFAULT\_DT;
            break;
          case "System.Boolean":  //checkboxes, bit values ecc
            dc.DefaultValue = false;
            break;
          default:
            break;
        }
      }
    }
    
    C# question database

  • form controls default values
    L LordZoster

    I found the answer at http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-ado-net/18455/Binding-DateTimePicker[^] Specifically: "Bart Mermuys - 28 Dec 2006 12:06 GMT [...] well it's the Binding that has a (private) modified flag which is triggered by the Control property-Changed event (eg. TextChanged/ValueChanged). The value isn't persisted if the modified flag hasn't been set. [...]Try to set default values on the DataSource. [...]If you're using NET2.0 you can use the DataTable.TableNewRow event. "

    C# question database

  • form controls default values
    L LordZoster

    Hallo I have the typical case of a form with some controls bound to a bindingsource (backed by a database). If the control default value is somewhat acceptable for the user (eg. a dtp shows the current date or a check box is unchecked) he lets them untouched, assuming their values will be written as is in the database. But this doesn't happen: if a control isn't touched by a user, it is ignored by bindingSource's EndEdit method. How can I avoid this? (I suppose this have already been discussed in many places, but I cannot find references, maybe I'm Googling with wrong keywords)

    C# question database

  • parent/child tables and bindingsources
    L LordZoster

    Hallo, thanks for reply. The control will display data from the bindingsource and permit editing. I'm currently using a dgv, but I'm actually aiming to use a treeview to list data informations, and a form to edit each single entry. My main question is still: could a bindingsource be bound to a couple of joined tables?

    C# question

  • parent/child tables and bindingsources
    L LordZoster

    Hallo I have two tables, let's say one Customers and one Orders, joined by CustomerID. I represented each one by a datatable of its own in a dataset, and I created a DataRelation. I would like to use them as datasource for one single BindingSource: is it possible?

    C# question

  • SendMessage to control with non-fixed ControlID
    L LordZoster

    thank you for the reply, I previously did a search and adapted a snippet found on Stackoverflow.com, but it (and many other examples in the net) shows how to address controls by their handle. In this case, I have a control contained into a modal window addressable by portion of its name (the only part that doesn't change).

    C# question

  • SendMessage to control with non-fixed ControlID
    L LordZoster

    Hallo I'd need to write into a textbox of an external application. Investigating with Spy++ I found that its controlID changes: the only thing helping to identify it unequivocally is the Class attribute: it is the only control of that Class in that form. How could I address the textbox by this value? Could you post a snippet? Thanks in advance

    C# 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