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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
D

dsovino

@dsovino
About
Posts
17
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Adding/Removing parent's keypressed handler on MDI child VisibleChange method
    D dsovino

    nope, didn't help, i keep getting the same problem.... i have to do it this way, if i try to go with the return way on the handler, the textbox that i want to work on doesn't get the typed text...

    C# docker question

  • Adding/Removing parent's keypressed handler on MDI child VisibleChange method
    D dsovino

    wow, faster than i could edit it. I accidentaly posted it before finishing it out. No, i'm not handling the visiblechange on form1 (parent), just on the child. this.visible actually refers to the child. i had to do it this way because the child form has a "searcher" textbox to a "SELECT blabla like" query on the textchange to a database.

    C# docker question

  • Adding/Removing parent's keypressed handler on MDI child VisibleChange method
    D dsovino

    Hi, I want to disable a keypress handler of a mdi container form. I'm adding this on the container's Form_load: this.KeyPress += new KeyPressEventHandler(Form1_KeyPressed); and this on the child's VisibleChange event: if (this.Visible) { principal.KeyPress -= new KeyPressEventHandler(principal.Form1_KeyPressed); } else { principal.KeyPress += new KeyPressEventHandler(principal.Form1_KeyPressed); } where principal is a property assigned on the child's load, in order to call the objects on the parent form: principal = (FormMain)this.MdiParent; When i run this the first time works. The handler works until I turn visible the child form for the first time (which tells me the -= is working), removing the parent's handler. After i visible=false the child, the handler gets added back, but now it calls 2 times the event attached instead of 1, and so on with every on/off of the child (3, 4, 5)... why? :doh: thanks a lot for your time. daniel

    C# docker question

  • multiple threads accesing msAccess
    D dsovino

    I was happily working on my solution with access, everything going sweet. Until i started to use backgroundworkers doing some inserts to the database, while the main thread was accessing the database calling the tableadapters as well for it's own purposes... Is there any way MSAcess can manage multiple calls to the database, or should i just forget about it and start working on something different. I was planning to include in the deploy the mdb file. I tested it, and it worked fine. But with this? Suggestions PLEASE :confused: Thanks for everyones time. Daniel Sovino

    Database database question

  • Multithreaded forms application
    D dsovino

    Hi, i'm building a solution that has plenty of forms interacting with each other, based on MDI Parent - child model. I created instances of them, never closing, just hiding those. I've also got some other forms that perform some analysis that might take a while. What i'm wondering :doh: is if it would be a good approach to make this calls to modalform on a different thread, or to only perform the long tasks on these forms on different thread in order to prevent the app to hold. Thanks for your time. I appreciate all suggestions. daniel sovino

    C#

  • Detecting key pressed on parent/childs MDI forms
    D dsovino

    It worked just by applying it on the Parent Form. Thanx a lot!! :laugh: daniel

    C# help lounge learning

  • Detecting key pressed on parent/childs MDI forms
    D dsovino

    Hi everyone, i would like to know if there's anyway I can detect a key pressed.:doh: I know there exists the KeyDown and KeyPress events on every control, but i would like to know if theres any way I can detect these events in general, instead of checking these events on all the controls of my application. I'm using a Parent Mdi Form containing lots of child forms, and of course this forms have lots of controls as well. I tried to apply this on the Parent Form's key events, but nothing. I bet there's a simple way to get this done. Please help. Thanks a lot for your time folks. daniel

    C# help lounge learning

  • getting a dataset of affected records,using an ExecuteNONQuery OleDbCommand
    D dsovino

    Ok, but how do I get this done? I had lots of troubles working with access database and the dataset wizard to store querys (http://forums.microsoft.com/MSDN/showpost.aspx?postid=1121807&siteid=1), so I opted to run my queries with code. I used one method with the Insert command, and if the result set is higher than 0, I call another method with a Scalar Command, to search for the ID. Then, with the retrieved ID, i call the third method to Insert the record ID on the second table.... :zzz: The code described below worked well, everyonce in a while (no clue yet why sometimes i'm able to get the ID and sometimes I get 0, probably something going on with the query). So that's why I want a safer way to get this done. I searched a little bit for "select @@identity" (http://support.microsoft.com/kb/816112), and I found out that it behaves as a Scalar command as well. So in theory, i should just change my query string to get it done. It doesnt work at all. Does the "select @@identity" statement work only when you handle it on a OleDbDataAdapter.RowUpdated Event? Thanks for the help! string file = "......"; private void InsertAudio() { // creation of queries, source, connections, etc.... OleDbCommand cmd = new OleDbCommand(sql, conexion); int resultSet; try { conexion.Open(); resultSet = cmd.ExecuteNonQuery(); if (resultSet > 0) SearchIDofCreatedRow(); } catch (OleDbException ode) { MessageBox.Show(ode.ToString(), "Error de Conexion con base de datos"); } finally {conexion.Close();} } private void SearchIDofCreatedRow() { // creation of queries, source, connections, etc.... OleDbCommand cmd = new OleDbCommand("SELECT ID FROM audios WHERE file='" + file + "'", conexion); try { conexion.Open(); int ID = Convert.ToInt32(cmd.ExecuteScalar()); AddCategoryList(ID); } //catch/finally..... } private void AddCategoryList(int ID) { // //Insert into the second table with the retrieved data.... // }

    daniel sovino

    C# question

  • getting a dataset of affected records,using an ExecuteNONQuery OleDbCommand
    D dsovino

    Hi to everyone! I need to get the autonumeric field assigned to a new record, because I want to use it on a different table. ExecuteNonQuery retrieves the number of affected rows. But how can I get a dataset result of the affected rows, as the one using an ExecuteQuery command? Thanks for everyones time! :doh: daniel sovino

    C# question

  • Inserting a Record in Access database using tableAdapter.
    D dsovino

    Hi everyone, i'm a little bit stuck. :doh: While i was amazing myself discovering the dateset design wizard (which means that me querys methods will get waaaay shorter now :laugh:), i'm not able to insert a row in the Access database. I'm using a query to load a treeview, which works just fine: private void GenerateTreeview() { treeView1.Nodes.Clear(); onAirDataSetTableAdapters.contenidoTableAdapter contAdap = new Loteria.onAirDataSetTableAdapters.contenidoTableAdapter(); DataTable tabla = contAdap.ObtenerDatos(); DataView dataViewHijos = new DataView(tabla); and so on.... } now, i want to add a node on the treeview, and store that into the database table where I have my items. I tried this on a try/catch/finally, just to make sure i'm not getting any errors. I call generateTreeview() function on finally, to reload my Treeview. try { onAirDataSetTableAdapters.contenidoTableAdapter contAdap = new Loteria.onAirDataSetTableAdapters.contenidoTableAdapter(); contAdap.InsertarCategoria(dlg.nombre, nodoPadretempID); } catch (OleDbException ode) { MessageBox.Show(ode.ToString(), "Error de Conexion con base de datos"); } catch (Exception er) { MessageBox.Show(er.ToString()); } finally { GenerateTreeview(); } Everything works ok, i get the updated Treeview while running my app, but the database doesn't get updated. I restart the app and i get the same initial treeview, and of course, no changes are being performed on the mdb... PLEASE HELP!! thanks for eveyones time :omg: kiweed

    C# help database design learning

  • Connection between 2 pcs via modem with C#
    D dsovino

    Hi everyone. I've been asked to research for a way to retrieve information from a remote pc, which only has modem conectivity, without internet access. I would just like to know if there's any way of doing this with c#. A good hint to start research would be helpfull as well. Thanks for everyone's time. :omg: daniel sovino

    C# csharp

  • Control Panel applets
    D dsovino

    simple as that. thanx a lot :laugh: daniel

    C# csharp sysadmin linux question

  • Control Panel applets
    D dsovino

    Hi, i'm developing an app where i want to detect internet connection status. I have a linked label on a statusbar (where i show if i'm connected or not). On the click event of the label, i have this code: try { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.UseShellExecute = false; proc.StartInfo.FileName = "cmd"; proc.StartInfo.Arguments = "rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl,,0"; proc.Start(); //proc.WaitForExit(); } catch { } As you can tell, the idea is to show the Network Connections avaible on the target system. I searched a while for it, and since C# doesn't support Shell, this is supossed to be the way. :doh: I'm just getting the cmd "poped up". It doesn't call the arguments. When I copy/paste the arguments string on cmd, i get the Network Connections window opened, but cmd remains open as well. Is there any other way to call the control panel applets in c#? If not, is there any way that to emulate the "Run..." from Start menu with c#? Thanks for your time fellas. :laugh: daniel sovino

    C# csharp sysadmin linux question

  • Adding Row to Access database table
    D dsovino

    Ooo yes. Last night while reading i found the answer as well. I just used 'string' instead of string. Numeric values without any characters. I'll keep in mind the # for date values in the future. thanks a lot for your help. I was stuck at least 1 week for this, and if it wasn't for your help i'll still be trying to use the dataset designer or whatever.... Here's the working code down below. I think it's the easiest way to add rows to a Access database in C#. No need for components!! peace!!!!! :) -------------------------------------------------------------------------------------- try { string source = "Provider=Microsoft.JET.OLEDB.4.0;"; source += "data source=D:\\tesis\\Importar Archivo\\Importando\\Importando\\bin\\radio.mdb;"; OleDbConnection conexion = new OleDbConnection(source); OleDbCommand comando = new OleDbCommand(); string auxsql = "INSERT INTO archivo (archivo, [ruta archivo], formato, tamaño, muestreo, bitrate, canales, duracionSeg, [tipo de audio]) "; auxsql += "VALUES ('" + Archivo + "', '" + path + "', 'desconocido'," + tamano.ToString() + ", " + muestreo + ", " + auxbitrate + ", " + canales + ", " + duracionms + ", '" + cbTipoAudio.Text + "')"; comando =new OleDbCommand(auxsql,conexion); conexion.Open(); comando.ExecuteNonQuery(); conexion.Close(); MessageBox.Show("Update successful"); } catch (System.Exception ex) { MessageBox.Show("Update failed:\r\n"+ex.ToString()); } daniel kiweed

    Database database csharp help announcement workspace

  • Adding Row to Access database table
    D dsovino

    yep, that made it work (the connection) I still have an error when i use an INSERT on the query. Just to make sure, i used the OleDbDataReader to make sure i was able to read the database and the connection was working. Everything ok with this: { OleDbConnection conexion = new OleDbConnection(source); OleDbCommand comando = new OleDbCommand(); string auxsql = "SELECT Id, archivo, [ruta archivo], formato, tamaño, muestreo, bitrate, canales, duracionSeg, [tipo de audio] FROM archivo"; comando =new OleDbCommand(auxsql,conexion); conexion.Open(); OleDbDataReader reader = comando.ExecuteReader(); while (reader.Read()) { txtSQL.Text += (reader.GetInt32(0) + ", " + reader.GetString(1)); } reader.Close(); } Now, when i use the code down below, i get an OledbException, "No value given for one or more required parameters." the CommandText is: INSERT INTO archivo (archivo, [ruta archivo], formato, tamaño, muestreo, bitrate, canales, duracionSeg, [tipo de audio]) VALUES (07-sublime-badfish-chupa.mp3, path , desconocido,4438226, 44100, 187, 2, 184839, Musica) so i don't get where the error might be at. { OleDbConnection conexion = new OleDbConnection(source); OleDbCommand comando = new OleDbCommand(); string auxsql = "INSERT INTO archivo (archivo, [ruta archivo], formato, tamaño, muestreo, bitrate, canales, duracionSeg, [tipo de audio]) "; auxsql += "VALUES (" + Archivo + ", " + "path "+ ", desconocido," + tamano.ToString() + ", " + muestreo + ", " + auxbitrate + ", " + canales + ", " + duracionms + ", " + cbTipoAudio.Text + ")"; comando =new OleDbCommand(auxsql,conexion); conexion.Open(); comando.ExecuteNonQuery(); conexion.Close(); } once again thanks for the help! daniel

    Database database csharp help announcement workspace

  • Adding Row to Access database table
    D dsovino

    thanks steve i tried to use your code, but i keep getting some errors. "Format of the initialization string does not conform to specification starting at index 92" on index 92 (line 92??) i have this: double auxmuestreo = Convert.ToDouble(muestreo); i think the problem is that im not specifing the type of the variabes. When i made the tables on access, some of the variables are strings, some are doubles i'm using this. string source = "Provider=Microsoft.JET.OLEDB.4.0;" + "data source=D:\\tesis\\Importar Archivo\\Importando\\Importando\bin\\radio.mdb"; OleDbCommand comando = new OleDbCommand(); OleDbConnection conexion = new OleDbConnection(source); string auxsql = "INSERT INTO archivo (archivo, [ruta archivo], formato, tamaño, muestreo, bitrate, canales, duracionSeg, [tipo de audio]) " + "VALUES (" + Archivo + ", " + path + ", desconocido" + tamano.ToString() + ", " + muestreo + ", " + bitrate + ", " + canales + ", " + duracionms + ", " + cbTipoAudio.Text + ")"; comando =new OleDbCommand(auxsql,conexion); conexion.Open(); comando.ExecuteNonQuery(); conexion.Close(); Once again, thanks a lot. im really stuck on this... daniel

    Database database csharp help announcement workspace

  • Adding Row to Access database table
    D dsovino

    Hi, i'm a newby in database in c#. What I want to do is add a new row to a microsoft access database. I dont use any tables or anything. I just want to get values from labels or whatever and then use that as values for my "Insert into.." query. I'm using the dataset designer, where I can see my tables and the corresponding tableadapters that were created. When I test the query on the QUERY CONFIGURATION WIZARD (using fake values), it works fine (i checked de mdb and it added the row with the fake values). What i want to do though is use the same query, but with the corresponding values from my FORM. So it would be like this: { INSERT INTO archivo (archivo, [ruta archivo], formato, tamaño, muestreo, bitrate, canales, duracionSeg, [tipo de audio]) VALUES (file, path, format, size, sampling, rate, channels, lenght, audiotype) } where (file, path, size, sampling, rate, channels, lenght & audiotype) are my variables that i get from the form. I called the query InsertarAudio, on archivoTableAdapter1. is there any way i can do this using the wizard and put in the query my external values, so i can then use something like this: try { archivoTableAdapter1.InsertarAudio(); MessageBox.Show("Update successful"); } catch (System.Exception ex) { MessageBox.Show("Update failed"); } ----------------- I also tried to use: radioDataSet.AcceptChanges(); try { archivoTableAdapter1.InsertarAudio(Archivo, path, auxext, auxsize, auxmuestreo, auxbitrate, auxcanales, auxduracion, cbTipoAudio.Text); MessageBox.Show("Update successful"); } catch (System.Exception ex) { MessageBox.Show("Update failed"); } here, where i use directly my variables, i was able to run the project, and the code worked fine (no errors), but it didn't update the mdb. Thanks to everyone for the time!!! Hope someone can help me out ;) daniel sovino

    Database database csharp help announcement workspace
  • Login

  • Don't have an account? Register

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