 |
BOOK: Beginning VB.NET Databases  | This is the forum to discuss the Wrox book Beginning VB.NET Databases by Thearon Willis; ISBN: 9780764568008 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning VB.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 22nd, 2006, 12:36 PM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
MS Access ComboBox GUID Error
I'm modifying the Access version of the Time Tracker app. and I need some help with a ComboBox. I wrote the following code based on page 175:
'Passing the value in the ComboBox to a field
objData.AddParameter("@BranchID", _
OleDb.OleDbType.Guid, 16, cboUserGroup.SelectedItem.item("BranchID"))
Instead of passing the value in the ComboBox to the appropriate table, it generates a new GUID. How do I modify it so that the values passes to the table?
I made the modification based on the following code on page 484:
MyBase.AddParameter("@RoleID", _
SqlDbType.UniqueIdentifier, 16, _
User.Tables("User").Rows(0).Item("RoleID"))
Any help would be greatly appreciated.
Thanks,
Mark
|
|

October 23rd, 2006, 06:29 PM
|
 |
Wrox Author
|
|
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
|
|
Mark,
Does the BranchID in the combo box contain a GUID or just a string formatted as a GUID? If the value is just a string formatted as a GUID you can try this: objData.AddParameter("@BranchID", OleDb.OleDbType.Guid, 16, New Guid(cboUserGroup.SelectedItem.item("BranchID")))
Thearon
|
|

October 24th, 2006, 07:57 PM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thearon,
The BranchID in the combo box does contain a GUID. Both the source and destination fields are "Number (Replication ID)" type.
Mark
|
|

October 28th, 2006, 09:02 AM
|
 |
Wrox Author
|
|
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
|
|
Mark,
What error are you getting when using the code I suggested?
Thearon
|
|

October 29th, 2006, 03:07 PM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thearon,
The error message reads:
Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:
'Public Sub New(g As String)': Argument matching parameter 'g' narrows from 'System.Object' to 'String'.
'Public Sub New(b() As Byte)': Argument matching parameter 'b' narrows from 'System.Object' to '1-dimensional
array of Byte'.
Mark
|
|

November 1st, 2006, 07:26 PM
|
 |
Wrox Author
|
|
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
|
|
Mark,
Can you set a break point on the line of code in question, post the one line of code, and post the value from BranchID?
Thearon
|
|

November 1st, 2006, 11:31 PM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thearon
The value of "BranchID" in a Watch window reads:
Name 'BranchID' is not declared.
Mark
|
|

November 6th, 2006, 07:16 AM
|
 |
Wrox Author
|
|
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
|
|
Mark,
In the Watch window you need to add a watch for cboUserGroup.SelectedItem.item("BranchID"). Do that and tell me what the value reads.
Thearon
|
|

November 6th, 2006, 05:43 PM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thearon
The value reads "empty".
Mark
|
|

November 6th, 2006, 06:03 PM
|
 |
Wrox Author
|
|
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
|
|
Mark,
That's a problem. It sounds like your query is not pulling back data for BranchID. Is that column selected in your query?
Thearon
|
|
 |