Problems inserting into attached MDF from MFC

Using Visual Studio 2008, MFC, C++, I am doing the following:

CDatabase db;
db.OpenEx(_T("Driver=SQL Server; Server=SUEDE\\SQLEXPRESS; Integrated 
Security=true; AttachDbFilename=C:\\Temp\\DesignList.mdf;"),
     CDatabase::noOdbcDialog);
CDesignData rs(&db);
rs.Open();
BOOL bUpdatable = rs.CanUpdate();
BOOL bAppendable = rs.CanAppend();
rs.AddNew();
rs.m_nDesignId = 5;
rs.m_sDesignName = _T("Hello");
rs.Update();


However, during the call to CRecordset::Open(), the record set is going into 
read-only mode.  The following is output in the debugger window:

DBMS: Microsoft SQL Server
Version: 09.00.3077
ODBC Driver Manager Version: 03.80.0000
Optional feature not implemented
State:S1C00,Native:0,Origin:[Microsoft][ODBC SQL Server Driver]

Warning: Driver does not support requested concurrency.
Optional feature not implemented
State:S1C00,Native:0,Origin:[Microsoft][ODBC SQL Server Driver]

Warning: Driver does not support requested concurrency.
Warning: Setting recordset read only.



It seems that the preparation of the SELECT call is failing during Open().

And any efforts to update my recordset fail.  bUpdatable ends up being 
false.

I've read that lack of a primary key may be the issue, however, my table in 
my MDF file has a primary key.

I've tried using a non-MDF (regular SQLExpress database) with similar 
results.

Any ideas?

Thanks,

....Matt

 

0
Matt
4/8/2010 8:28:25 PM
sqlserver.programming 1873 articles. 0 followers. Follow

1 Replies
1044 Views

Similar Articles

[PageSpeed] 34

On Apr 8, 4:28=A0pm, "Matt Houser" <m...@houser.ca> wrote:
> Using Visual Studio 2008, MFC, C++, I am doing the following:
>
> CDatabase db;
> db.OpenEx(_T("Driver=3DSQL Server; Server=3DSUEDE\\SQLEXPRESS; Integrated
> Security=3Dtrue; AttachDbFilename=3DC:\\Temp\\DesignList.mdf;"),
> =A0 =A0 =A0CDatabase::noOdbcDialog);
> CDesignData rs(&db);
> rs.Open();
> BOOL bUpdatable =3D rs.CanUpdate();
> BOOL bAppendable =3D rs.CanAppend();
> rs.AddNew();
> rs.m_nDesignId =3D 5;
> rs.m_sDesignName =3D _T("Hello");
> rs.Update();
>
> However, during the call to CRecordset::Open(), the record set is going i=
nto
> read-only mode. =A0The following is output in the debugger window:
>
> DBMS: Microsoft SQL Server
> Version: 09.00.3077
> ODBC Driver Manager Version: 03.80.0000
> Optional feature not implemented
> State:S1C00,Native:0,Origin:[Microsoft][ODBC SQL Server Driver]
>
> Warning: Driver does not support requested concurrency.
> Optional feature not implemented
> State:S1C00,Native:0,Origin:[Microsoft][ODBC SQL Server Driver]
>
> Warning: Driver does not support requested concurrency.
> Warning: Setting recordset read only.
>
> It seems that the preparation of the SELECT call is failing during Open()=
..
>
> And any efforts to update my recordset fail. =A0bUpdatable ends up being
> false.
>
> I've read that lack of a primary key may be the issue, however, my table =
in
> my MDF file has a primary key.
>
> I've tried using a non-MDF (regular SQLExpress database) with similar
> results.
>
> Any ideas?
>
> Thanks,
>
> ...Matt

I've seen this in the past & this message seems to go away when I set
the nOpenType =3D dynaset. I have no idea why so I'd be interested to
see if anyone has an explanation too.
0
itsthesource
4/9/2010 1:41:34 AM
Reply:

Similar Artilces:

Here is fix for Windows file problems
If you have installed a Windows update and started having problems opening, closing, copying files, see: http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.excel.misc&mid=1fe358b1-c8eb-4217-ad2a-4b9fcf741916 A better solution is offered at http://support.microsoft.com/kb/918165 "Problems in Windows Explorer or the Windows shell after you install security update MS06-015". Patricia Shannon wrote: > If you have installed a Windows update and started having problems opening, > closing, copying files, see: > > http://ww...

i want to compress photos in attachment
i want to compress photos in attachment pl. give me some sol. regards www.irfranview.com "compress photos in attachment" <compress photos in attachment@discussions.microsoft.com> wrote in message news:738E96D6-F0E2-4FFF-8570-6A8F00E492D1@microsoft.com... :i want to compress photos in attachment : : pl. give me some sol. : : regards On Apr 22, 7:50=A0am, compress photos in attachment <compress photos in attachm...@discussions.microsoft.com> wrote: > i want to compress photos in attachment > > pl. give me some sol. > > regards...

Problem with CFTPConnection
Hi I've an application that connects to an FTP Server and uploads a big directory (size over 500 MB). Now what happens is that after sometime the application stops uploading files and stays idle. The FTP server connection timeout value is set to 2 minutes. So the server seeing the connection idle for two seconds, disconnect the session and no more file is uploaded. On debugging I found out that after some time CFTPConnection.PutFile() method hangs on some random file and stays like that for 5 minutes (default send timeout value of CFTPSession). During this time the server connection timeo...

Excel 97 Win XP calc problem?
I have a machine running office 97 and Win XP. I have seen posts stating it runs fine, but I don't know how man people use spreadsheets that require a hard calculation: Excel will not force a calculation. i.e. ctrl-alt-f9 does not cause full workbook calculation as required. Meaning cells do not update and it doesn't calculate unless you clic in the cell to edit and hit enter. neither does the "Calc Now" button. Auto or manual calculation mode has no effect. Anybody else have this problem -- Message posted from http://www.ExcelForum.com Make sure that both the SR1 a...

Cannot open Excel attachment from e-mail when Excel is already ope
This is driving me crazy. If I already have Excel open (with or with out a spreadsheet open) I cannot open an Excel spreadsheet attached to an e-mail. If I close Excel and retry it will open Excel and the spreadsheet. Any ideas? I hate having to close all my open spreadsheets when I want to open a spreadsheet that's been e-mailed to me! One of these usually works with a similar problem starting workbooks by double clicking them in Windows Explorer. Maybe one will work for you and your email problem. Tools|Options|General|Ignore other applications (uncheck it) --- or --- Close E...

How to Debug MFC dll
I have a VS 2003 soln with 2 projects - 1 MFC Dialog based app and the other MFC dll. I am loading the MFC dll from my MFC app. If I set breakpoints in the MFC dll code, it doesn't stop there. How do I debug the dll ? Regards, Amit Is the DLL linked in with the App or do you dynamically load it? AliR. "Cagespear" <Cagespear@discussions.microsoft.com> wrote in message news:C19EC4DF-2AC0-4BD3-B1C3-4C356A4EDF4C@microsoft.com... >I have a VS 2003 soln with 2 projects - 1 MFC Dialog based app and the >other > MFC dll. > > I am loading the MFC dll from my...

CRM Outlook Client Configuration Wizard Problem
CRM 4.0 - Microsoft Outlook Client Guys, We've Microsoft CRM 4.0 Server roll up 8 as well as CRM Outlook Client on the same roll up version. Our Internal Web Access works without problems users get to it and they're automatically authenticated. IFD Development is the same way except they're prompt through a login page for their username and password when they're coming from an external network. Ever since we moved to a new facility users are experiencing problems connecting to CRM using their outlook client, I have a test machine where I have the CRM Outlook Client ins...

Problem with Update function of CRecordSet class
Hi All When I use from Update function of CRecordSet class, it apply to table after a few time(for example 1 second) when I need to see it at time. Thanks ...

Adding support for mfc / atl types in a Win32 project
MSDN says this about adding support for classes shared between atl & mfc (I'm just after points and rects btw)... just add the header ( atltypes.h ). I'm getting linker errors for these classes though. Is there a lib I need to add? Any screwy build options need changing? It's in VC 2003. In the project wizard I note that atl and mfc support aren't available when creating an empty Win32 application. Ta. On 26 May 2006 07:42:09 -0700, Simon L wrote: > MSDN says this about adding support for classes shared between atl & > mfc (I'm just after points and rect...

Problem with macro assigned to custom toolbar button
Problem with macro assigned to custom toolbar button I am having a probelm with macros assigned to a custom button on custom button. I am using excel 2000. 1. I have created a macro called "Jump" in a workbook named "Test1" 2. I then created a custom toolbar and added a custom toolbar button t that toolbar. 3. Through the customize dialog box I assign the Macro "Jump" to th custom button. Everything works fine UNTIL. If I do a SAVE AS for the workbook "Test1" and call it something els like "Test2" and then close "Test2" an...

OL2002 Problem : HELP, SOS, MAYDAY
Hi, I have an IMAP account and OL2002 as client. I have checked for my account ( tools, send/receive settings, define send/receive groups, <my_account>, edit) download item description only. It works only the first time I start OL2002, but it does not work anymore for subsequent automatic/manual send/receive operations. Please could someone really help me ? Thank you in advance, Patrick ...

Preventing dissambly/decompiliation of MFC Apps and DLLs
Hello, I was wondering if there are any software products out there that will take a compiled MFC app or MFC DLL and prevent the files from being disassemble or being decompiled? Sincerely, James Simpson James Simpson wrote: > Hello, > I was wondering if there are any software products out there that will take > a compiled MFC app or MFC DLL and prevent the files from being disassemble or > being decompiled? > > Sincerely, > > James Simpson > Whether or not MFC is used is irrelevant. There is no way to prevent or even resist disassembly. If it is execut...

request to solve my problem #5
hello friends this is vijay,i got a problem while doing my project based on vc++ (i.e)"How to implement Fit Window feature in VC++6.0 in an MDI Application" if any of you got any idea about that please do reply me with the proceedure.i will be waiting for your reply bye with regards vijayprasadreddy ...

Excel. I am having a problem with hidden text
As I type text in some cells, it does not always dispaly if it exceeds the cell length. I wish to keep the cell lenghts for the entire document, but do wish for teh text in that particular row to be displayed. How about if you select that cell, then format|cells|alignment tab|check wrap text And with that row selected format|row|autofit SHR77 wrote: > > As I type text in some cells, it does not always dispaly if it exceeds the > cell length. I wish to keep the cell lenghts for the entire document, but do > wish for teh text in that particular row to be displayed. -- Da...

Attachments #99
I can only view attachments if I save them first. Who do I change the settings so that I can just open the attachments without saving them first? Justine <anonymous@discussions.microsoft.com> wrote: > I can only view attachments if I save them first. Who do > I change the settings so that I can just open the > attachments without saving them first? What happens when you try? -- Brian Tillman When I try to open an attachment there is a pop up and it only gives me the option of saving the attachment. >-----Original Message----- >Justine <anonymous@discussions.m...

email attachments
Why is Word 2007 opening all my email attachments? It probably isn't. Outlook 2007 has a new text editor that looks just like Word 2007, but it is in reality a separate text editor in its own .dll package. -- Terry Farrell - MSWord MVP "josie" <josie@discussions.microsoft.com> wrote in message news:5961A60C-462F-4CBA-A276-4A8D0F7FB1F5@microsoft.com... > Why is Word 2007 opening all my email attachments? It depends on which file of file or file extension the attachment is. Each type of file extension (*.txt, *.doc etc.) has a default program. It ...

Opening Excel email attachments
When downloading excel files AOL says cannot find suitable program.I then go online to find Excel but only get Uopdates. PC is XP version with Works Suite 2002. A fe months back my dear wife was downloading Excel an got board with waiting and shut down the PC! Any suggestions. Thanks Karl Hi there's no legal way to download Excel!! You have to buy< an Excel version and install it on your PC (or try to open the file with MS Works - but live with the restricted functionality) >-----Original Message----- >When downloading excel files AOL says cannot find >suitable progra...

Outlook 2000 slow to attach files
I am running Outlook 2000 with XP, and when I go to attach a file on the network, it is extremely slow. However, when I go to the same file through Windows Explorer, it is very quick. Does anyone know what this problem might be or how to fix it? ...

Excel List Sorting Problem (Descending)
Hi there, I'm having trouble sorting my list--my column contains *only* 4-digit numbers but when I click on "descending order", only about the first half of the rows are arranged this way, before it begins again to arrange the rest in descending order. Like this: 5120 5119 5118 4000 3050 5116 4112 etc. Has this problem happened for anybody else? I'd appreciate any help you can offer. Part of your list is text, although it looks like numbers. Format an empty cell as number. Enter the number 1. Copy. Select your "numbers". Edit>Paste Special, check Mul...

I really need help with a formview problem
I have a formview that I place a toolbar onto. In my OnInitialUpdate(), after I create the toolbar, I say GetParentFrame()->RecalcLayout(); ResizeParentToFit(FALSE); ResizeParentToFit(TRUE); The formview is still not sized properly. It looks like the problem is the toolbar on the top of the formview. It is not being taken into account in sizing the formview. The difference at the bottom of the form that is not displayed is the size of the toolbar. Any suggestions? Should work if your toolbar was created (and docked) back in your CMainFrame::OnCreate() method. ----- William Gower ...

Printing problem in booklet format
When I try to print my booklet document, on the screen it looks perfect, but when i go into print preview it only has half of each page on the paper. When i print, it comes out exactly like that. I have Publisher 2003 and run it on XP home. My printer is an Epson stylus Photo RX650. I contacted Epson and they say its a Publisher problem. Any suggestions. Driver? http://tech.epson.com.au/downloads/product.asp?sCategory=Multi_Functional&id=stylusphotorx650&FileType=1&EmailAdd=&MetricIDReturned=624915&platform=winxp Are you selecting booklet in page setup? Do you ...

problem opening up program/file
Hello, All. I am having some trouble opening up Word. It was working okay until I loaded some fonts to FontBook. Okay, now I removed all my fonts but I still get this error message about corrupt fonts I have on my computer. When I open Word, I see the blue starting-up window: Word:Mac 2004. Right underneath the product ID #, I see that it is initiating... when it gets to the point "Optimizing font menu performance" I start getting this error windows popping up one after another. (E.g. The font M TimesSmallText is corrupt and should be removed.) I keep on clicking okay for a whole lot...

Money deluxe 2007 password problem
When I update my bank account transactions I get a message saying that my account was not updated because my password is incorrect. I then go into account info and have to update my password. I save the update, but then it happens again sporadically when I open Money at later times. Is there a way to fix this glitch? ...

Missing attachments
I am having an intermittant problem with Outlook 2002 on Windows XP on several machines. Sometimes the attachments (usually Excel) make it to the recipient. Sometimes they don't. When they don't make it there is no indication to the recipient that there even was an attachment. Though the Sender's sent mail clearly has the attachment. I've got the latest patches to Windows & Outlook and am going through an Exchange 5.5 server. The user does not use Word for the email editor. We've tried changing email format from Rich Text to HTML to Plain Text and the ...

Outlook 2000 Attachment Error
I'm getting the following error when I try opening up e- mail attachments I have received in Outlook 2000, Windows NT. "An error has occurred while the following action was performed: Query Outlook for the Outlook Extension Callback Interface. Error: 0x80004002 Description: No such interface supported I then receive a 2nd message - "The operation failed due to network or other communication problems. Check your connections and try again. The attachment types are typically .msg format. ...