Trying to Take Data from One BO to Another (Not the Same Structure)


Author
Message
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
The Code That causes the Problem is:





If Me.ContestantsPRCABO1.MoveFirst Then

Dim howmany As Integer

howmany = Me.ContestantsPRCABO1.Count

MessageBox.Show(howmany.ToString, "Number of contestants")

Dim cnt As Integer

For cnt = 1 To howmany

Me.ContestantsProRodeoBO1.NewRow()



Me.ContestantsProRodeoBO1.RodeoID = Me.ContestantsPRCABO1.rodeoId

Me.ContestantsProRodeoBO1.MembershipCD = Me.ContestantsPRCABO1.membershipCD

Me.ContestantsProRodeoBO1.MembershipNumber = Me.ContestantsPRCABO1.membershipNumber

Me.ContestantsProRodeoBO1.Nationality = Me.ContestantsPRCABO1.nationality

...............

Me.ContestantsProRodeoBO1.Fee = 0

Me.ContestantsProRodeoBO1.EventBB = String.Empty

Me.ContestantsProRodeoBO1.EventBR = ""

Me.ContestantsProRodeoBO1.EventGB = ""

Me.ContestantsProRodeoBO1.EventRB = ""

Me.ContestantsProRodeoBO1.EventSB = ""

Me.ContestantsProRodeoBO1.EventSR = ""

Me.ContestantsProRodeoBO1.EventSW = ""

Me.ContestantsProRodeoBO1.EventTD = ""

Me.ContestantsProRodeoBO1.EventTR = ""

Me.ContestantsProRodeoBO1.Save()



Next



End If





The Lines above the ................... work fine but the ones below Do Not. ????



In the New Table(where the data is going) I have contraints like the following:



ALTER TABLE [dbo].[Contestants] ADD CONSTRAINT [DF_Contestants_EventBB] DEFAULT ('') FOR [EventBB]



ALTER TABLE [dbo].[Contestants] ADD CONSTRAINT [DF_Contestants_SubjectToWithHolding] DEFAULT ((0)) FOR [SubjectToWithHolding]



CONSTRAINT [PK_Contestants] PRIMARY KEY CLUSTERED

([ContPK] ASC

)



The Error I get is a lengthy one:





MicroFour.StrataFrame.Data.DataLayerSavingException was unhandled by user code

Message="Invalid column name 'SubjectToWithHolding'. Invalid column name 'EventBB'. Invalid column name 'EventBR'. Invalid column name 'EventGB'. Invalid column name 'EventRB'. Invalid column name 'EventSB'. Invalid column name 'EventSR'. Invalid column name 'EventSW'. Invalid column name 'EventTD'. Invalid column name 'EventTR'. Invalid column name 'Fee'. Invalid column name 'ContPK'. Invalid column name 'ContPK'."

Source="MicroFour StrataFrame Business"

StackTrace:

at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTable(DataTable TableToUpdate, Boolean Transactional, String TransactionKey)

at MicroFour.StrataFrame.Data.DataLayer.Save(DataTable TableToSave, Boolean Transactional, String TransactionKey)

at MicroFour.StrataFrame.Business.BusinessLayer.Save(Boolean Transactional, String TransactionKey)

at MicroFour.StrataFrame.Business.BusinessLayer.Save()

at DevExpressGridTwoDataBasesSF.Form1.Button3_Click(Object sender, EventArgs e) in C:\VSProjects\DevExpressGridTwoDataBasesSF\DevExpressGridTwoDataBasesSF\Form1.vb:line 53

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

InnerException: System.Data.SqlClient.SqlException

Class=16

ErrorCode=-2146232060

LineNumber=1

Message="Invalid column name 'SubjectToWithHolding'. Invalid column name 'EventBB'. Invalid column name 'EventBR'. Invalid column name 'EventGB'. Invalid column name 'EventRB'. Invalid column name 'EventSB'. Invalid column name 'EventSR'. Invalid column name 'EventSW'. Invalid column name 'EventTD'. Invalid column name 'EventTR'. Invalid column name 'Fee'. Invalid column name 'ContPK'. Invalid column name 'ContPK'."

Number=207

Procedure=""

Server=".\sqlexpress"

Source=".Net SqlClient Data Provider"

State=1

StackTrace:

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

at System.Data.SqlClient.SqlDataReader.get_MetaData()

at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)

at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)

at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)

at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)

at MicroFour.StrataFrame.Data.DbDataSourceItem.InternalExecuteReader(DbCommand Command, Boolean IsTransactional, String TransactionKey)

at MicroFour.StrataFrame.Data.SqlDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler, Boolean RecreateCommand)

at MicroFour.StrataFrame.Data.DbDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler)

at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)

InnerException:





Any help would be greatly Appreciated. TIA.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Terry Bottorff - 15 Years Ago
Greg McGuffey - 15 Years Ago
Terry Bottorff - 15 Years Ago
Terry Bottorff - 15 Years Ago
Greg McGuffey - 15 Years Ago
                         I will try a simple maintenance form. That is a good idea. I recreated...
Terry Bottorff - 15 Years Ago
                             First Off a maintenance form on the the BO that has the Data works...
Terry Bottorff - 15 Years Ago
                                 Hi Terry,

Move this code me.ContestantsPRCABO1.MoveNext()...
Edhy Rijo - 15 Years Ago
                                     Edhy I tried your Option 1 and I looked at the BO where the data is...
Terry Bottorff - 15 Years Ago
                                         [quote][b]Terry Bottorff (10/02/2009)[/b][hr]I will try your 2nd...
Edhy Rijo - 15 Years Ago
                                             Also remember to check the help file for more detail on using the...
Edhy Rijo - 15 Years Ago
                                                 I tried the following code and the if me.ContestantsRodeoBO1.IsDirty...
Terry Bottorff - 15 Years Ago
                                                     [quote][b]Terry Bottorff (10/04/2009)[/b][hr]I'm at a lost as to what...
Edhy Rijo - 15 Years Ago
                                                         Also you may need to play with the value needed for each RowState, in...
Edhy Rijo - 15 Years Ago
                                                             Does it make a difference that one BO is coming from one database and...
Terry Bottorff - 15 Years Ago
                                                                 Nope, it does not.

Did you try it?
Edhy Rijo - 15 Years Ago
                                                                 Well Edhy with your new code(Data.DataRowState.Unchange ) I now get...
Terry Bottorff - 15 Years Ago
                                                                     Try this:

Just change:...
Edhy Rijo - 15 Years Ago
                                                                     [quote][b]Terry Bottorff (10/04/2009)[/b][hr]Well Edhy with your new...
Edhy Rijo - 15 Years Ago
                                                                         [codesnippet]
For Each contestantsBO As ContestantsRodeoBO In...
Terry Bottorff - 15 Years Ago
                                                                             [quote][b]Terry Bottorff (10/04/2009)[/b][hr]
I tried the above...
Edhy Rijo - 15 Years Ago
                                                                                 The ContestantsRodeoBO does have a PK in the database and it shows up...
Terry Bottorff - 15 Years Ago
                                                                                     You can setup a Bo without a primary key. Look in the help file or the...
Edhy Rijo - 15 Years Ago
                                                                                         You might try using the SetDefaultValues event to get the work done....
Greg McGuffey - 15 Years Ago
                                                                                             Terry, I have been away for a while and as you have noticed haven't...
Trent L. Taylor - 15 Years Ago
                                                                                                 This is the structure of the BO that Has Data:
CREATE TABLE...
Terry Bottorff - 15 Years Ago
                                                                                                     Boy, there a lot of NOT NULLs in the target table :blink:
...
Greg McGuffey - 15 Years Ago
                                                                                                         Terry,

What I meant for you to post was an actual sample....
Trent L. Taylor - 15 Years Ago
                                                                                                             The two databases are secretarysystem and rodeo with...
Terry Bottorff - 15 Years Ago
                                                                                                                 Sorry Terry, I don't have devExpress so I will not be able to test...
Edhy Rijo - 15 Years Ago
                                                                                                                     Edhy if you can see the grid you can delete it since I just had it on...
Terry Bottorff - 15 Years Ago
                                                                                                                         Terry,

You have 2 BOs and 2 Databases, and in the...
Edhy Rijo - 15 Years Ago
                                                                                                                             The ContestantsPRCABO is connected to the secretarysystem database and...
Terry Bottorff - 15 Years Ago
                                                                                                                                 I got and I also reproduced the error. There are couple of thing...
Edhy Rijo - 15 Years Ago
                                                                                                                                     Hi Terry,

Here is a working project with not DevExpress...
Edhy Rijo - 15 Years Ago
                                                                                                                                         I will spend a lot of time on this sample. I thank you very much. I...
Terry Bottorff - 15 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search