Ok, I try to clarify things a little bit. I have one computer where my program is installed. The database that is used by my program is in the same directory as my program.
Then I shared this folder where my program and my database are located to local area network. Then I accessed this folder from another computer on my LAN network and made a shortcut of my program to that computers desktop.
Launched the program, data is nicely inserted to datagridview. I can filter data by sql statements. Now I open another form in my program which is used for editing: edit the data, hit "Save" and the messagebox pops up saying: "Can't connect to database!" (I set this exception when I was coding my program). Same thing is with adding new record form. I use datasets, adapters and bindingsources that wizard has set up.
Code for saving after editing:
Code:Try 'Me.Validate() Me.TableBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.TableDataSet) MsgBox("Saved successfully!", MsgBoxStyle.Information, "Catalogue") Catch ex As Exception MsgBox("Can't connect to database!", MsgBoxStyle.Information, "Catalogue") End Try
Code for adding new row:
Code:Try MainForm.TableAdapter.Insert(Me.ComboProfiil.Text, Me.PikkusTextBox.Text) MainForm.TableAdapter.Fill(MainForm.TableDataSet.Table) MsgBox("New item saved successfully!", MsgBoxStyle.Information, "Catalogue") Catch ex As Exception MsgBox("Can't connect to database!", MsgBoxStyle.Exclamation, "Catalogue") End Try




Reply With Quote