run-time error '3197'. MS Access 2010 and SQL Server 2008R2 - ms-access-2010

I have an application written in MS Access 2007-2010 and a back end is an SQL database.
After building a new database, when I view the records from SQL in the Access report, trying to edit or enter new input results with a run-time error 3197.
The specific error says:
This record has been changed by another user since you started editing it
Then I have Copy to Clipboard and Drop Changes options, while the Save Record is grayed out.
Clicking on the Drop changes brings the error:
"Run-Time Error '3197'
The Microsoft Access database engine stopped the process because you and another user are attempting to change the same data at the same time."
I then looked in the SQL and queried the database with EXEC sp_who2 'Active' and I can see that the user name I use for SQL is RUNNABLE while the user used by the Access application (coded in Access VBA) is SUSPENDED (the command it is suspended on is SELECT).
I have other databases that are constructed the same way and work with no issues. I've checked sp_who2 on the working database when it's running with Access, and the user that is SUSPENDED for the "problematic" database, is sleeping with this one.
I've checked the permissions for both databases, and checked the permissions for the users in Security--> Logins and don't see anything that I can flag as an issue (maybe someone else can?).
Not sure why this is happening and why the database is locked by the SQL user and won't let the Access user update the relevant records.
Can anyone shed some light on this issue?
Thanks.

As Remou commented, changing all bit data types to smallint and populating with 0 where Null did the trick. I didn't need to change 1 to -1 as my fields where to be in the initial state of unticked (=0).

As suggested, I updated the data in the field that had the bit datatype from null to 0, also changed the datatype to int. That fixed the problem.

I had the same issue,
sql2 = "Select * from voeding where id = " & ID_Voeding_Site.Value & ""
Set rst2 = bbase.OpenRecordset(sql2)
rst2.Edit
rst2.Fields("verwerkt").Value = 1
rst2.Fields("printdatum").Value = Date
rst2.Update
rst2.Close
Was stuck on .update. I Changed it to:
sql2 = "Select Verwerkt, Printdatum from voeding where id = " & ID_Voeding_Site.Value & ""
Set rst2 = bbase.OpenRecordset(sql2)
rst2.Edit
rst2.Fields("verwerkt").Value = 1
rst2.Fields("printdatum").Value = Date
rst2.Update
rst2.Close
No More troubles appeared. Hope this helps others.

Related

Intershop: How To Delete a Channel After Orders Have Been Created

I am able to delete a channel from the back office UI and run the DeleteDomainReferences job in SMC to clear the reference and be able to create a new channel again with the same id.
However, once an order has been created, the above mentioned process won't work.
I heard that we can run some stored procedures against the database for situation like this.
Question: what are the stored procedures and steps to take to be able to clean any reference in Intershop so that I can create a channel with the same id again?
Update 9/26:
I did configure a new job in SMC to call DeleteDomainReferencesTransaction pipeline with ToBeRemovedDomainID attribute set to the domain id that I am trying to clean up.
The job ran without error in the log file. The job finished almost instantly, though.
Then I ran the DeleteDomainReferences job in SMC. This is the job I normally run after deleting a channel when there is no order in that channel. This job failed the following exception in the log file.
ORA-02292: integrity constraint (INTERSHOP.BASKETADDRESS_CO001) violated - child record found
ORA-06512: at "INTERSHOP.SP_DELETELINEITEMCTNRBYDOMAIN", line 226
ORA-06512: at line 1
Then I checked BASKETADDRESS table and did see the records for that domain id. This is, I guess, the reason why DeleteDomainReferences job failed.
I also execute the SP_BASKET_OBSERVER with that domain id, but it didn't seem to make a difference.
Is there something I am missing?
sp_deleteLineItemCtnrByDomain
-- Description : This procedure deletes basket/order related stuff.
-- Input : domainID The domain id of the domain to be deleted.
-- Output : none
-- Example : exec sp_deleteLineItemCtnrByDomain(domainid)
This stored procedure should delete the orders. Look up the domainid that you want to delete in the domaininformation table and call this procedure.
You can also call the pipeline DeleteDomainReferencesTransaction. Setup an smc job that calls this pipeline with the domainid that you want to clean up as a parameter. It also calls a second sp that cleans up the payment data so it actually a better approach.
Update 9/27
I tried this out on my local 7.7 environments. The DeleteDomainReferences job also removes the orders from the isorder table. No need to run sp_deleteLineItemCtnrByDomain separately. Recreating the channel I see no old orders. I'm guessing that you discovered a bug in the version you are running. Maybe related to the address table being split into different tables. Open a ticket for support to have them look at this.
With the assistance from intershop support, it has been determined that, in IS 7.8.1.4, the sp_deleteLineItemCtnrByDomain.sql has issue.
line 117 and 118 from 7.8.1.4
delete from staticaddress_av where ownerid in (select uuid from staticaddress where lineitemctnrid = i.uuid);
delete from staticaddress where lineitemctnrid = i.uuid;
should be replaced by
delete from basketaddress_av where ownerid in (select uuid from basketaddress where basketid = i.uuid);
delete from basketaddress where basketid = i.uuid;
After making the stored procedure update, running DeleteDomainReference job finishes without error and I was able to re-create the same channel again.
The fix will become available in 7.8.2 hotfix as I was told.

BizTalk 2013 file receive location trigger on non-event

I have a file receive location which is schedule to run at specific time of day. I need to trigger a alert or mail if receive location is unable to find any file at that location.
I know I can create custom components or I can use BizTalk 360 to do so. But I am looking for some out of box BizTalk feature.
BizTalk is not very good at triggering on non-events. Non-events are things that did not happen, but still represent a certain scenario.
What you could do is:
Insert the filename of any file triggering the receive location in a custom SQL table.
Once per day (scheduled task adapter or polling via stored procedure) you would trigger a query on the SQL table, which would only create a message in case no records were made that day.
Also think about cleanup: that approach will require you to delete any existing records.
Another options could be a scheduled task with a custom c# program which would create a file only if there were no input files, etc...
The sequential convoy solution should work, but I'd be concerned about a few things:
It might consume the good message when the other subscriber is down, which might cause you to miss what you'd normally consider a subscription failure
Long running orchestrations can be difficult to manage and maintain. It sounds like this one would be running all day/night.
I like Pieter's suggestion, but I'd expand on it a bit:
Create a table, something like this:
CREATE TABLE tFileEventNotify
(
ReceiveLocationName VARCHAR(255) NOT NULL primary key,
LastPickupDate DATETIME NOT NULL,
NextExpectedDate DATETIME NOT NULL,
NotificationSent bit null,
CONSTRAINT CK_FileEventNotify_Dates CHECK(NextExpectedDate > LastPickupDate)
);
You could also create a procedure for this, which should be called every time you receive a file on that location (from a custom pipeline or an orchestration), something like
CREATE PROCEDURE usp_Mrg_FileEventNotify
(
#rlocName varchar(255),
#LastPickupDate DATETIME,
#NextPickupDate DATETIME
)
AS
BEGIN
IF EXISTS(SELECT 1 FROM tFileEventNotify WHERE ReceiveLocationName = #rlocName)
BEGIN
UPDATE tFileEventNotify SET LastPickupDate = #LastPickupDate, NextPickupDate = #NextPickupDate WHERE ReceiveLocationName = #rlocName;
END
ELSE
BEGIN
INSERT tFileEventNotify (ReceiveLocationName, LastPickupDate, NextPickupDate) VALUES (#rlocName, #LastPickupDate, #NextPickupDate);
END
END
And then you could create a polling port that had the following Polling Data Available statement:
SELECT 1 FROM tFileEventNotify WHERE NextPickupDate < GETDATE() AND NotificationSent <> 1
And write up a procedure to produce a message from that table that you could then map to an email sent via SMTP port (or whatever other notification mechanism you want to use). You could even add columns to tFileEventNotify like EmailAddress or SubjectLine etc. You may want to add a field to the table to indicate whether a notification has already been sent or not, depending on how large you make the polling interval. If you want it sent every time you can ignore that part.
One option is to set up a BAM Alert to trigger if no file is received during the day.
Here's one mostly out of the box solution:
BizTalk Server: Detecting a Missing Message
Basically, it's an Orchestration that listens for any message from that Receive Port and resets a timer. If the timer expires, it can do something.

Audit trail setting in oracle 11g

I would like to know how to view the oracle 11g audit setting.
i need to check if it is enabled or not.
I read audit_trail will help but when i run the query "select * from audit_trail" it returns invalid table error.
You can check the audit status via
SHOW parameter audit_trail
or
SELECT name, value FROM v$parameter WHERE name = 'audit_trail';
if it is set to none then auditing if off, anything else and it is on.
See here for more information on the choices for this value.

The Ghost of a Renamed Table

I have renamed a table in a SQL Server 2008 database, from eL_CourseStepUserNotes to StepUserNotes. I renamed the table using the SSMA.
The table is used in a ASP.NET 4.0 app. I use LINQ to SQL for all CRUD. The problem is that the following code:
dbDataContext db = new dbDataContext();
var k = (from c in db.StepUserNotes
where ((c.CourseStepFK == q.CourseStepFK) && (c.UserFK == q.UserFK))
select c).FirstOrDefault();
try
{
db.StepUserNotes.InsertOnSubmit(q);
db.SubmitChanges();
}
catch
{
}
Fails on the db.SubmitChanges line, saying:
SqlException was caught. Invalid object name 'eL_CourseStepUserNotes'.
Ie, the old name for the table has come back to haunt me.
I have deleted the old LINQ to SQL dbml file and created a new one. I have searched through all the source code for strings that contain the old table name. Nothing. The code compiles...
Where else can I look?
The error is coming back from SQL Server, and using the utility for listing all foreign keys in a sql server database shown in SO question:
sql:need to change constraint on rename table?
reveals no sign of the old table name in FKs either.
I am at a complete loss as to where to look or what to try next. Any suggestions?
Answer:
The problem, as stated by Stu and Stark was a trigger. Stu gave me the SQL to run that nailed the problem. It is documented here in case anyone else runs into this:
Select Object_Name(ID) From SysComments
Where Text Like '%el_CourseStepUserNotes%'
This revealed a trigger with the following name:
tr_eL_CourseStepUserNotes
The trigger referenced the old name as follows:
SET DateAmended = CURRENT_TIMESTAMP
FROM eL_CourseStepUserNotes PP
INNER JOIN inserted i ON PP.UserNoteId = i.UserNoteId
Everything is now working again.
Silly me, I should have realised that a trigger was the problem as the first error I got was related to the DateAmended field.
I have no idea why a trigger would update when a table name changed. I had checked all Keys and relationships, but forgot this trigger.
Live and learn.
When you recreated your linq to sql file, did you remember to refresh the server browser to reflect the table name change first?
Edit - I mean the visual studio server browser.
you need to rebind your LINQ To SQL class, drop all the tables, then add them again from the Server Explorer
open your project in visual studio.
open your dbml file.
find the table you just have renamed.
select and delete it.
Save.
Open server Explorer.
Connect to your database.
Find the table which you have renamed.
Drag and drop on the designer of your dbml file.
Save the file again.
Compile your project.
It is not necessary to drop the tables from your DBML file. You can simply open the designer, click on the class diagram representing your table and type the new name of the table.
However, if you're recreating from scratch it is important to refresh in Server Explorer otherwise it will still pull the old name from the schema.

Community server Username issue - User Username not found in membership store does not exist

I have an error occuring frequently from our community server installation whenever the googlesitemap.ashx is traversed on a specific sectionID. I suspect that a username has been amended but the posts havn't recached to reflect this.
Is there a way a can check the data integruity by performing a select statement on the database, alternatively is there a way to force the database to recache?
This error could be thrown by community server if it finds users that aren't in the instance of MemberRoleProfileProvider.
See CommunityServer.Users AddMembershipDataToUser() as an example
UPDATE:
I Solved this problem for my case by noticing that the usernames are stored in two tables - cs_Users and aspnet_Users. Turns out somehow the username was DIFFERENT in each table. Manually updating so the names were the same fixed this problem.
Also, the user would left out of membership in the following line of the stored procedure cs_Membership_GetUsersByName:
INSERT INTO #tbUsers
SELECT UserId
FROM dbo.aspnet_Users ar, #tbNames t
WHERE LOWER(t.Name) = ar.LoweredUserName AND ar.ApplicationId = #ApplicationId
The #tbNames is a table of names comes from cs_Users(?) at some point and therefore the usernames didn't match and user was not inserted in to the result later on.
See also: http://dev.communityserver.com/forums/t/490899.aspx?PageIndex=2
Not so much an answer, but you can find the affected data entries by running the following query...
Select *
FROM cs_Posts
Where UserID Not In (Select UserID
From cs_Users Where UserAccountStatus = 2)

Resources