Solved

SQL Server Security Issue?

Posted on 2014-11-20
11
98 Views
Last Modified: 2014-11-21
Challenge:
Using the following code to supply data to a form using SQL Server Express 2012 Allows data editing on the resulting form.
Using the same code with connection to SQL Server 2008 Express causes the data to be read only in the form.
Code Snippet:
80       OpenSQLConnection
         
90       Set rs_Temp = New ADODB.recordset
         
100      With rs_Temp
110         Set .ActiveConnection = rs_Cnn
120         .Source = SQLStatement
130         .CursorLocation = adUseServer
140         .LockType = adLockOptimistic
150         .CursorType = adOpenDynamic
160         .CursorLocation = adUseClient
170         .Open
180      End With

190      Set FormRS = rs_Temp

Open in new window


What am I missing? An SQL Server security setting?
0
Comment
Question by:Kurt Bergman
  • 5
  • 4
  • 2
11 Comments
 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
Are you connecting to both databases with the same SQL Server user?
If so, check the user permissions in each database. I'll bet that he has write permission in the SQL Server 2012 DB and read only on SQL Server 2008 DB.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
is there a primary key on both tables (aka on the table in both instances)
I don't recall anything else to "block" edit mode

this would also be checkable in the .CursorLocation, .CursorType and .LockType , after the .Open line, not to match the values requested .

BTW, I see this minor issue:
130         .CursorLocation = adUseServer
...
160         .CursorLocation = adUseClient

the last one shall win, so line 130 is obsolete.
0
 

Author Comment

by:Kurt Bergman
Comment Utility
Databases are identical (copied one to the other)
line 130 (I forgot to comment out this line) you HAVE to use adUseClient to use OpenDynamic in Access with no linked tables.
0
 

Author Comment

by:Kurt Bergman
Comment Utility
Victor:
In the 2012 version Under [My Database]\Security\Users\[My User]
Under General there is a field: Login Name:

That field does not exist in the 2008 version.

Am I missing something?
0
 

Author Comment

by:Kurt Bergman
Comment Utility
Guy:
I went back and checked the 2008 Version...
PKs and FKs had been dropped during the copying process

It works now
What a dummy :-(

Thank you for bringing this up
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
How you did the copy?
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
>What a dummy :-(
happened a couple of times to me, so no need for shame.
main point is: it got fixed :)
0
 

Author Comment

by:Kurt Bergman
Comment Utility
Hi Victor, because I was rolling back from 2012 to 2008 the only method I could think of was to import the tables into Access from 2012 and then upsize them to 2008. That's where I lost my indexes.
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
There's a Copy Database Wizard option in SSMS that allows you to do that directly (from MSSQL 2012 to 2008).
0
 

Author Comment

by:Kurt Bergman
Comment Utility
this doesn't appear to be available in the Express version under tasks.
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
You're right. Not available in Express Edition.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now