FillByPrimaryKey problem


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Glad you got it going Smile
Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)
Group: Forum Members
Posts: 29, Visits: 79
I reset my desktop and it work... Anyway.. thanks guys...!!

Have a good one

Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)
Group: Forum Members
Posts: 29, Visits: 79
Hi,

I tried before a SQL  Fill data table and the same result. I know how to make a basic sql statement and there is somehow there is something wrong ... 

What I did:

1- Add BO to the project

2- Use the BO mapper to configure my project and the BO , build ok

3- Rebuild the solution

4- Drop the BO object on my form

5- Tried several times the fill FillDataTable with SQL string (same error)

The thing is that my SF DB in on server A and my testing DB in on server B. Both connection were created with the Connection Wizard. But, the SqlException shows server A eventhough the BO was created with server B. I think the answer comes from there ... Any idea?

Note:

I add 'this' only the guys who replied for my question BigGrin

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Setting the Debug on is always a good idea when you run into something like this.  When you are using the intrinsic methods, there are some assumptions made by the framework.  In the case of the FillByPrimaryKey, we assume that a primary key has been defined on the BO, for example.

As a side note, there is really no need to create a method to call the intrinsic method.  You can direcly call the FillByPrimaryKey and pass it the PK value.  If you are going to create a custom method, then you might go ahead and call the FillDataTable method and see if you are having the same problems.

I recommend using an SQLDbCommand and parameterized queries, but just for testing purposes, you can just pass a SELECT statement as well.

this.FillDataTable("SELECT * FROM MyTable WHERE MyPk=123");

See if you get the same response in this scenario.  But definitely go through the debug mode as well so we can see what the problem is that you are running into.

Note: Just as a side note, you do not have to provide the pre-qualifying location in .NET (Me or this).  If you call the FillByPrimaryKey method it is the same as calling this.FillByPrimeryKey.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
As you mentioned, this "should" work. Did you turn on SQL debugging to see exactly what SQL was being generated? That often help you the error.



In AppMain.cs (or whatever is the main app file in C#), at the bottom of the SetDataSources() method, add this:



DataBasics.DataSources("").SetDebugOn("c:\Debug.html",True);



For more info, see the last post on this page:



http://forum.strataframe.net/Topic3442-6-2.aspx?Highlight=SetDebugOn



Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)
Group: Forum Members
Posts: 29, Visits: 79
I tried already ...(calling from the code,  not BO) ... no success
Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)
Group: Forum Members
Posts: 29, Visits: 79
It's a typo mistake ... in my code it's written this.FillByPrimaryKey(user)

I am still having the SqlException "invalid object name with TABLENAME"

 


Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Have you tried to just calling FillByPrimaryKey(user) from code (not in the BO, but from some other code)? Do you get the exception then?
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I think in C## it would be:



this.FillByPrimaryKey(user);



Ben Kim
Ben Kim
StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Did you try:

Me.FillByPrimaryKey(User)?

Ben

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search