|
-
Aug 20th, 2009, 01:42 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Images in SQL Express
I am creating a small program for me to manage "Proof of Service" documents. These digital documents will prove that I was actually there and that the work was completed.
The form connects to a SQL Express DB and has just a few fields per table. On this particular form, I have an image displayed by a PictureBox. I can get the pictures on the screen and everything is peachy there. However, I can not get any subsequent records, after the first, to save. Eventually, I want to hook up a HID USB pen device to my laptop to capture the signature. Right now, I am just using paint.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Process.Start("c:\windows\system32\mspaint.exe")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
OpenFileDialog1.ShowDialog()
Dim dir As String
dir = OpenFileDialog1.FileName
MsgBox(dir)
ApprovedBySignaturePictureBox.Load(dir)
ApprovedBySignaturePictureBox.Refresh()
End Sub
Exception Info Here:
Code:
System.InvalidOperationException was unhandled
Message="Update requires a valid UpdateCommand when passed DataRow collection with modified rows."
Source="Proof of Service"
StackTrace:
at Proof_of_Service.ProofOfServiceDataSetTableAdapters.TableAdapterManager.UpdateAll(ProofOfServiceDataSet dataSet) in C:\Users\mbutler755\Documents\Visual Studio 2008\Projects\Proof of Service\Proof of Service\ProofOfServiceDataSet.Designer.vb:line 3450
at Proof_of_Service.EnterNewInvoice.NewInvoiceBindingNavigatorSaveItem_Click(Object sender, EventArgs e) in C:\Users\mbutler755\Documents\Visual Studio 2008\Projects\Proof of Service\Proof of Service\EnterNewInvoice.vb:line 6
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Proof_of_Service.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Any help or ideas would be greatly appreciated.
Last edited by mbutler755; Apr 25th, 2010 at 10:08 AM.
-
Aug 20th, 2009, 01:49 AM
#2
Re: Images in SQL Express
The problem is with one (or more) of your TableAdapters. You're trying to save records that you've edited but your TableAdapter has no SQL code for that, hence the error message:
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
Either you told the wizard not to generate an UPDATE statement when you configured your TableAdapter or else the wizard was unable to do so. In the latter case it would be caused by either:
1. Your SELECT statement joined two or more tables; or
2. Your SELECT statement didn't return the table's primary key.
My guess is option 2 and because you haven't given your table a primary key in the first place. You can't update a record if you can't identify it and the primary key is specifically for the purpose of uniquely identifying a record.
-
Aug 20th, 2009, 11:15 AM
#3
Thread Starter
Hyperactive Member
Re: Images in SQL Express
 Originally Posted by jmcilhinney
The problem is with one (or more) of your TableAdapters. You're trying to save records that you've edited but your TableAdapter has no SQL code for that, hence the error message:Either you told the wizard not to generate an UPDATE statement when you configured your TableAdapter or else the wizard was unable to do so. In the latter case it would be caused by either:
1. Your SELECT statement joined two or more tables; or
2. Your SELECT statement didn't return the table's primary key.
My guess is option 2 and because you haven't given your table a primary key in the first place. You can't update a record if you can't identify it and the primary key is specifically for the purpose of uniquely identifying a record.
You are right on. I will make the changes and let you know. Thanks!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|