Sorry for late reply. If you want to have a faster development time, you have to use the predefine or auto-gen code for your development, it will slow down the work, but it save in coding. But if you have time to design a better software structure, it will take time but faster in performance. It's depends on your choice.
Jacky Yiu
Posts
-
question on database query -
question on database query- the connectionString has been stored in Properties.settings. 2) if you were drag and drop the datatable in to your program, SELECT, UPDATE, DELETE, INESRT Command will generate to you automatically... Depends on the usage in your program, if you will handle all sql command, it should be "faster". but if the record is not larger than 100,000. I don't think there has too much different. But development time ;P
-
why update data is wrong..it's prevent if there has 2 users editing the record, if A has submit the update command, then B SHOULD NOT be update and the program should handle the roll back. a easy example, if 2 people want to buy a movie ticket online, and they were select for the same seat, if A has submit the data, could B update the DB also?? if the update command is ready, just provide the dataset/datatable to the adapter is fine in your case, it should be: father.Update(son);
-
Setting value in installer and reading at runtimeyou can store the user option in registry or in a config file, if you were not planning to write file, registry may be a choice.
-
question on database queryare you want to select the record from the DataTable that the row index = listBox1.SelectedIndex???? if so, why not DataRow row = store.Rows[listBox1.SelectedIndex]; name.Text = row[1].ToString(); ... And there has a RowFilter properties in DataView(or DataTable.DefaultView), you can use it for filter any record you want... check it out in MSDN: http://msdn2.microsoft.com/en-us/library/system.data.dataview.rowfilter.aspx[^]
-
why update data is wrong..if your "father" (is it a good variable name?? :doh: ) mean SqlDataAdapter, why don't you update the whole dataset or datatable??? and SqlDataAdapter.Update will be execute the UpdateCommand that predefine in the SqlDataAdapter.UpdateCommand, did you set the command correctly??
-
sql database problemAs I posted before: this.textbox.text = ds.DataTable[0].Rows[0]["name"].ToString();
-
ListBox eventsThere has no OnInsert or AfterInsert, but listbox has ControlAdded and ControlRemoved, see if it's help.
-
Binding Combo box with databaseAre you want the combobox contain the display and the id of the display name? If so, set the DisplayMember and ValueMember to the combobox. When SelectedIndexChanged you can get the SelectedText and SelectedValue
-
Loading treeview from database using BackGroundWorker classAdd a "DoWork" event to the backgroundWorker fire backgroundWorker.RunSync(DataSet); just paste the code in backgroundWorker_DoWork is fine
-
update desktop project from webBuild > Publish %Your Project Name% If you publish it to web, the program at client desktop will auto check the version number and update from the source url.
-
Scrolling in formDid you set the panel2.AutoScroll to true? It's default is false
-
sql database problemBecause the table name is the one you added in the dataset: DataTable table999; string command = "select * from Table1"; SqlDataAdapter father = new SqlDataAdapter(command, myConnection); DataSet son = new DataSet(); son.Tables.Add("Table1"); father.Fill(son, "Table1"); ... That's work. But there has only one select statement in your case, why don't you use the index rather than table name?
-
sql database problemthis.textbox.text = ds.DataTable[0].Rows[0]["name"].ToString();
-
Scrolling in formyou want to scroll bar show in the panel or your user control??
-
Editable Grid On Keypressyou can add a javascript event capture the keypress, if event == f2, then fire the callback and set the gridview as editmode. FYR. function dosomething() { var key = window.event.keyCode; alert(key); }
-
Editable Grid On Keypress2 simple way to complete your requirement. 1.) add a menustrip in your application, then add an item and set the shortcut to f2 2.) add a keyboard event handler in your app and detect if key == Key.f2 either way to fire a function to set the gridview tobe edit mode.
-
ToolStripMenuItems from SQLCreate a function call "GenerateToolStripMenu()" or something, when you filled the data to the dataset, fire the function. e.g. for (int i = 0; i < database1DataSet.Table1.Rows.Count; i++) { menuStrip1.Items.Add(database1DataSet.Table1.Rows[i][%your_column_name_here%].ToString()); }
-
ToolStripMenuItems from SQLwhy don't you create the control when the sql load completed?
-
How to count imgae files in a folderThen you can use System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders(); to get all supported image format, or you could create your own image format array to loop the extension as I mention(and what you did).