Jump to content
Xtreme .Net Talk

HDokes

Avatar/Signature
  • Posts

    32
  • Joined

  • Last visited

Everything posted by HDokes

  1. I think I am just about there.... I have created an Update command for both tables and initialized them through the program. My last hurdle seems to be with the actual command text ..... here is what I have thus far tho I can not determine how to state the 'WHERE' statement to allow the values to 'update' the datasource UPDATE [button Assignment Table] SET ButtonTemplateNumber = ?, ButtonTitle = ?, ClipName = ?, ButtonID = ?
  2. hehehe... posted the last one before I realized you posted yours... As I look through the code... there are entries for the 'select' and 'insert' options but none for 'update' Here is the select and insert for the 1st adapter.... 'OleDbSelectCommand1 ' Me.OleDbSelectCommand1.CommandText = "SELECT ButtonIDSet, TemplateID, TemplateName FROM [button Template Table]" Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1 ' 'OleDbConnection1 ' Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _ "ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""C:\Sound Effects System\" & _ "SoundFX\SoundSystem.mdb"";Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk" & _ " Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Je" & _ "t OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Databa" & _ "se Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale " & _ "on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Je" & _ "t OLEDB:Encrypt Database=False" ' 'OleDbInsertCommand1 ' Me.OleDbInsertCommand1.CommandText = "INSERT INTO [button Template Table] (ButtonIDSet, TemplateName) VALUES (?, ?)" Me.OleDbInsertCommand1.Connection = Me.OleDbConnection1 Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("ButtonIDSet", System.Data.OleDb.OleDbType.Integer, 0, "ButtonIDSet")) Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("TemplateName", System.Data.OleDb.OleDbType.VarWChar, 50, "TemplateName")) 'OleDbDataAdapter1 ' Me.OleDbDataAdapter1.InsertCommand = Me.OleDbInsertCommand1 Me.OleDbDataAdapter1.SelectCommand = Me.OleDbSelectCommand1 Me.OleDbDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "Button Template Table", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("ButtonIDSet", "ButtonIDSet"), New System.Data.Common.DataColumnMapping("TemplateID", "TemplateID"), New System.Data.Common.DataColumnMapping("TemplateName", "TemplateName")})}) Me.OleDbDataAdapter1.UpdateCommand = Me.OleDbCommand1 This seems to be all the references to the updatecommand.
  3. Ok... a bit of discovery, I have checked both OleDbDataAdapter objects and it is clear there is no UpdateCommand in their respective 'update command' properties. Shouldn't the wizard have allowed for this? The question is, what commands should I have placed in here?
  4. Hi Jon, Yes.... here is the UpdateDataSource Routine. Public Sub UpdateDataSource(ByVal ChangedRows As SoundFX.dstButtonTemplate) Try 'The data source only needs to be updated if there are changes pending. If (Not (ChangedRows) Is Nothing) Then 'Open the connection. Me.OleDbConnection1.Open() 'Attempt to update the data source. OleDbDataAdapter1.Update(ChangedRows) OleDbDataAdapter2.Update(ChangedRows) End If Catch updateException As System.Exception 'Add your error handling code here. Throw updateException Finally 'Close the connection whether or not the exception was thrown. Me.OleDbConnection1.Close() End Try End Sub As I stated, this is code that is auto generated by .NET's form database wizard. Seems odd it wouldn't work 'out of the box' a s it were.
  5. Greetings again, Thanks Robby for the info. This at least allows me to 'push' a text string into the last cell selected which in the end is what I wanted to achieve. Seems a bit odd however that there are no immediate mouse events that can be captured when clicking inside the datagrid. This would have made the process I am working on more seemless and would have eliminated a couple a step that the user is forced to initiate... i.e.... click on a button after selecting the cell. I used the following line to 'fill' the cell.... grdButton_Assignment_Table.Item(grdButton_Assignment_Table.CurrentCell.ColumnNumber, grdButton_Assignment_Table.CurrentCell.RowNumber) = openFileDialog1.FileName
  6. Hello, I am using a datagrid on a database form in VB from which I would like to be able to establish and perform a piece of code upon a double click within the cell. My dilema is that while in the 'edit' mode of the form, when I double click on a any cell in the datagrid, the entire datagrid is selected and takes me to the following: Private Sub grdButton_Assignment_Table_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles grdButton_Assignment_Table.Navigate End Sub I can find no reference in the MSDN libraries that would show how one could 'trap' on a 'double click' within a cell and add code to that 'trap'. If I can not 'trap' on a 'double click' then I could otherwise allow the user to 'select' a file through a button trap (which I have tried) however I can find no method for pushing the subsequent string of data into the last selected cell in the datagrid. Any ideas?
  7. Greetings, I have used the .NET 2003 "Add Inherited Form" "Data form wizard" to create a form which uses two tables from an Access 2000 database. The tables are relational in nature with a 1 to many relationship. The wizard creates the form with no issues and loads the data accordingly however when I attempt an update I receive the message provided in the subject line above. I have seen another thread on this forum with this same message however I believe that my approach is a bit differenct than the gentleman in the other thread. I have re-created this form using two tables, a table and a query, and a query, in every instance I receive the same message. The following represents the 'update' code for this particular form: Public Sub UpdateDataSet() 'Create a new dataset to hold the changes that have been made to the main dataset. Dim objDataSetChanges As SoundFX.dstButtonTemplate = New SoundFX.dstButtonTemplate 'Stop any current edits. Me.BindingContext(objdstButtonTemplate, "Button Template Table").EndCurrentEdit() Me.BindingContext(objdstButtonTemplate, "Button Assignment Table").EndCurrentEdit() 'Get the changes that have been made to the main dataset. objDataSetChanges = CType(objdstButtonTemplate.GetChanges, SoundFX.dstButtonTemplate) 'Check to see if any changes have been made. If (Not (objDataSetChanges) Is Nothing) Then Try 'There are changes that need to be made, so attempt to update the datasource by 'calling the update method and passing the dataset and any parameters. Me.UpdateDataSource(objDataSetChanges) objdstButtonTemplate.Merge(objDataSetChanges) objdstButtonTemplate.AcceptChanges() Catch eUpdate As System.Exception 'Add your error handling code here. Throw eUpdate End Try 'Add your code to check the returned dataset for any errors that may have been 'pushed into the row object's error. End If End Sub I am pariculary confused as there has been no alteration in every method tried to the actual code generated by the Wizard.
×
×
  • Create New...