From: B on 5 Jul 2010 18:45 I am using ADODB to manipulate a Microsoft Access database from MatLab, V. 7.0.0 (R14), but I can’t seem to make the Seek method of the Recordset object to work when I pass an array of values to form a composite key. Here is the code that sets things up: db_path = ['E:\pathstring' '\' 'filename.mdb']; str_connect = 'Provider=Microsoft.Jet.OLEDB.4.0; Data Source='; % open an ADODB connection to the database cn = actxserver('ADODB.Connection'); cn.Open([str_connect db_path]); rs = actxserver('ADODB.Recordset'); % adOpenKeyset = 1, adLockOptimistic = 3, adCmdTableDirect = 512 rs.Open('tablename', cn, 1, 3, 512); rs.Index = 'Tuple'; i = 1; j = 1; k = 1; Using MoveFirst and Fields, I’ve verified that the above code yields a valid recordset. However, Seek gives me one of the following two errors: >> rs.Seek({int32(i),int32(j),int32(k)}, 1); ??? Invoke Error, Dispatch Exception: Source: ADODB.Recordset Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Help File: C:\WINDOWS\HELP\ADO270.CHM Help Context ID: 12ee41 >> rs.Seek({int32(i);int32(j);int32(k)}, 1); ??? Invoke Error, Dispatch Exception: Source: ADODB.Recordset Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Help File: C:\WINDOWS\HELP\ADO270.CHM Help Context ID: 12ee41 >> rs.Seek(int32([i;j;k]), 1); ??? Invoke Error, Dispatch Exception: Source: Provider Description: Type mismatch. >> rs.Seek(int32([i,j,k]), 1); ??? Invoke Error, Dispatch Exception: Source: Provider Description: Type mismatch. >> system_dependent('COM_SafeArraySingleDim', 1); >> rs.Seek({int32(i),int32(j),int32(k)}, 1); ??? Invoke Error, Dispatch Exception: Source: ADODB.Recordset Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Help File: C:\WINDOWS\HELP\ADO270.CHM Help Context ID: 12ee41 >> rs.Seek({int32(i);int32(j);int32(k)}, 1); ??? Invoke Error, Dispatch Exception: Source: ADODB.Recordset Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Help File: C:\WINDOWS\HELP\ADO270.CHM Help Context ID: 12ee41 >> rs.Seek(int32([i;j;k]), 1); ??? Invoke Error, Dispatch Exception: Source: Provider Description: Type mismatch. >> rs.Seek(int32([i,j,k]), 1); ??? Invoke Error, Dispatch Exception: Source: Provider Description: Type mismatch. >> As you can see, I've tried a lot of different variations, but I always get one of these two errors. Can anyone tell me what I am doing wrong, and how to do this correctly?
From: B on 6 Jul 2010 17:30 Ideas, anyone?
|
Pages: 1 Prev: try matlab to get the data from serial port Next: Stopping A Running Function Via Button |