![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
|
Content-Class: urn:content-classes:message From: "Simon Jackson" <simon.jackson (AT) alexismedical (DOT) co.uk Sender: "Simon Jackson" <simon.jackson (AT) alexismedical (DOT) co.uk Subject: "System Error" using System.Data.OdbcDataAdapter in 1.1 DNF with Visual FoxPro Date: Fri, 29 Aug 2003 06:33:38 -0700 Lines: 22 Message-ID: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Thread-Index: AcNuMid5xGgOVZ8FRTCED2QPp0qu3w== X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Newsgroups: microsoft.public.dotnet.framework.odbcnet Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.odbcnet:2952 NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet Does anyone know why when I execute the following code on the 1.1 dot net framework I receive an OdbcException with description "System Error". Public Sub DeleteCustomer(custId As Integer) 'Use connection configured using the form designer Dim FoxCmd As New OdbcCommand("delete from customers where id = ?", FoxCnn) FoxCmd.CommandType = CommandType.Text FoxCmd.Parameters.Add("id", OdbcType.Decimal) FoxCmd.Parameters("id").Value = custId Try FoxCnn.Open() FoxCmd.ExecuteNonQuery() Finally FoxCnn.Close() End Try End Sub |
#2
| |||
| |||
|
|
Content-Class: urn:content-classes:message From: "Simon Jackson" <simon.jackson (AT) alexismedical (DOT) co.uk Sender: "Simon Jackson" <simon.jackson (AT) alexismedical (DOT) co.uk References: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl TvmVE3UcDHA.1928 (AT) cpmsftngxa06 (DOT) phx.gbl Subject: RE: "System Error" using System.Data.OdbcDataAdapter in 1.1 DNF with Visual FoxPro Date: Thu, 4 Sep 2003 05:06:07 -0700 Lines: 108 Message-ID: <0e6401c372dc$ec51c7e0$a101280a (AT) phx (DOT) gbl MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcNy3OxRTJD8YSR7RAqgmiveDdnzow== Newsgroups: microsoft.public.dotnet.framework.odbcnet Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.odbcnet:2968 NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161 X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet Hi Kevin, The custId is a FoxPro numeric data type. When using the adapter configuration wizard to create the command it maps this to OdbcType.Decimal. Because the database is Visual FoxPro I'm using the System.Data.Odbc provider to connect. Its wierd because if i set the database up in Access and use the same code but with the MsJet4 OleDb data provider instead of the Odbc provider it works? -----Original Message----- What is the exact data type of the custId, string or integer? The following is a example for your reference: ===================== Private Function CreateDataAdapterDeleteCommand() As OleDbCommand Dim strSQL As String strSQL = "DELETE FROM [Order Details] " & _ " WHERE OrderID = ? AND ProductID = ? AND " & _ " Quantity = ? AND UnitPrice = ?" Dim cmd As New OleDbCommand(strSQL, cn) Dim pc As OleDbParameterCollection = cmd.Parameters Dim param As OleDbParameter pc.Add("OrderID", OleDbType.Integer, 0, "OrderID") param.SourceVersion = DataRowVersion.Original pc.Add("ProductID", OleDbType.Integer, 0, "ProductID") param.SourceVersion = DataRowVersion.Original pc.Add("Quantity", OleDbType.SmallInt, 0, "Quantity") param.SourceVersion = DataRowVersion.Original pc.Add("UnitPrice", OleDbType.Currency, 0, "UnitPrice") param.SourceVersion = DataRowVersion.Original Return cmd End Function ====================== Sincerely, Kevin Microsoft Support This posting is provided "AS IS" with no warranties, and confers no rights. Get Secure! - www.microsoft.com/security -------------------- | Content-Class: urn:content-classes:message | From: "Simon Jackson" simon.jackson (AT) alexismedical (DOT) co.uk | Sender: "Simon Jackson" simon.jackson (AT) alexismedical (DOT) co.uk | Subject: "System Error" using System.Data.OdbcDataAdapter in 1.1 DNF with Visual FoxPro | Date: Fri, 29 Aug 2003 06:33:38 -0700 | Lines: 22 | Message-ID: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl | MIME-Version: 1.0 | Content-Type: text/plain; | charset="iso-8859-1" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Thread-Index: AcNuMid5xGgOVZ8FRTCED2QPp0qu3w== | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 | Newsgroups: microsoft.public.dotnet.framework.odbcnet | Path: cpmsftngxa06.phx.gbl | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.odbcnet:2952 | NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 | X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet | | Does anyone know why when I execute the following code on | the 1.1 dot net framework I receive an OdbcException with | description "System Error". | | Public Sub DeleteCustomer(custId As Integer) | | 'Use connection configured using the form designer | Dim FoxCmd As New OdbcCommand("delete from customers | where id = ?", FoxCnn) | | FoxCmd.CommandType = CommandType.Text | FoxCmd.Parameters.Add("id", OdbcType.Decimal) | FoxCmd.Parameters("id").Value = custId | | Try | FoxCnn.Open() | FoxCmd.ExecuteNonQuery() | Finally | FoxCnn.Close() | End Try | | End Sub | . |
#3
| |||
| |||
|
|
-----Original Message----- So, can you use the System.data.oledb provider to connect to the FoxPro file? Sincerely, Kevin Microsoft Support This posting is provided "AS IS" with no warranties, and confers no rights. Get Secure! - www.microsoft.com/security -------------------- | Content-Class: urn:content-classes:message | From: "Simon Jackson" simon.jackson (AT) alexismedical (DOT) co.uk | Sender: "Simon Jackson" simon.jackson (AT) alexismedical (DOT) co.uk | References: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl TvmVE3UcDHA.1928 (AT) cpmsftngxa06 (DOT) phx.gbl | Subject: RE: "System Error" using System.Data.OdbcDataAdapter in 1.1 DNF with Visual FoxPro | Date: Thu, 4 Sep 2003 05:06:07 -0700 | Lines: 108 | Message-ID: <0e6401c372dc$ec51c7e0$a101280a (AT) phx (DOT) gbl | MIME-Version: 1.0 | Content-Type: text/plain; | charset="iso-8859-1" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 | Thread-Index: AcNy3OxRTJD8YSR7RAqgmiveDdnzow== | Newsgroups: microsoft.public.dotnet.framework.odbcnet | Path: cpmsftngxa06.phx.gbl | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.odbcnet:2968 | NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161 | X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet | | Hi Kevin, | | The custId is a FoxPro numeric data type. When using the | adapter configuration wizard to create the command it maps | this to OdbcType.Decimal. | | Because the database is Visual FoxPro I'm using the | System.Data.Odbc provider to connect. | | Its wierd because if i set the database up in Access and | use the same code but with the MsJet4 OleDb data provider | instead of the Odbc provider it works? | | >-----Original Message----- | >What is the exact data type of the custId, string or | integer? | | >The following is a example for your reference: | | >===================== | >Private Function CreateDataAdapterDeleteCommand() As | OleDbCommand | > Dim strSQL As String | > strSQL = "DELETE FROM [Order Details] " & _ | > " WHERE OrderID = ? AND ProductID = ? | AND " & _ | > " Quantity = ? AND UnitPrice = ?" | > Dim cmd As New OleDbCommand(strSQL, cn) | | > Dim pc As OleDbParameterCollection = cmd.Parameters | > Dim param As OleDbParameter | > pc.Add("OrderID", OleDbType.Integer, 0, "OrderID") | > param.SourceVersion = DataRowVersion.Original | > pc.Add("ProductID", OleDbType.Integer, 0, "ProductID") | > param.SourceVersion = DataRowVersion.Original | > pc.Add("Quantity", OleDbType.SmallInt, 0, "Quantity") | > param.SourceVersion = DataRowVersion.Original | > pc.Add("UnitPrice", OleDbType.Currency, | 0, "UnitPrice") | > param.SourceVersion = DataRowVersion.Original | | > Return cmd | >End Function | >====================== | | >Sincerely, | | >Kevin | >Microsoft Support | | >This posting is provided "AS IS" with no warranties, and | confers no rights. | >Get Secure! - www.microsoft.com/security | | >-------------------- | >| Content-Class: urn:content-classes:message | >| From: "Simon Jackson" | <simon.jackson (AT) alexismedical (DOT) co.uk | >| Sender: "Simon Jackson" | <simon.jackson (AT) alexismedical (DOT) co.uk | >| Subject: "System Error" using | System.Data.OdbcDataAdapter in 1.1 DNF with | >Visual FoxPro | >| Date: Fri, 29 Aug 2003 06:33:38 -0700 | >| Lines: 22 | >| Message-ID: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl | >| MIME-Version: 1.0 | >| Content-Type: text/plain; | >| charset="iso-8859-1" | >| Content-Transfer-Encoding: 7bit | >| X-Newsreader: Microsoft CDO for Windows 2000 | >| Thread-Index: AcNuMid5xGgOVZ8FRTCED2QPp0qu3w== | >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 | >| Newsgroups: microsoft.public.dotnet.framework.odbcnet | >| Path: cpmsftngxa06.phx.gbl | >| Xref: cpmsftngxa06.phx.gbl | microsoft.public.dotnet.framework.odbcnet:2952 | >| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 | >| X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet | >| | >| Does anyone know why when I execute the following code | on | >| the 1.1 dot net framework I receive an OdbcException | with | >| description "System Error". | >| | >| Public Sub DeleteCustomer(custId As Integer) | >| | >| 'Use connection configured using the form designer | >| Dim FoxCmd As New OdbcCommand("delete from customers | >| where id = ?", FoxCnn) | >| | >| FoxCmd.CommandType = CommandType.Text | >| FoxCmd.Parameters.Add("id", OdbcType.Decimal) | >| FoxCmd.Parameters("id").Value = custId | >| | >| Try | >| FoxCnn.Open() | >| FoxCmd.ExecuteNonQuery() | >| Finally | >| FoxCnn.Close() | >| End Try | >| | >| End Sub | >| | | >. | | . |
#4
| |||
| |||
|
|
Content-Class: urn:content-classes:message From: "Simon Jackson" <simon.jackson (AT) alexismedical (DOT) co.uk Sender: "Simon Jackson" <simon.jackson (AT) alexismedical (DOT) co.uk References: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl TvmVE3UcDHA.1928 (AT) cpmsftngxa06 (DOT) phx.gbl |
|
Subject: RE: "System Error" using System.Data.OdbcDataAdapter in 1.1 DNF with Visual FoxPro Date: Fri, 5 Sep 2003 04:34:16 -0700 Lines: 171 Message-ID: <2a8501c373a1$a35e48e0$a601280a (AT) phx (DOT) gbl MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcNzoaNepYcGZQ0oRqKbtv3MsJKYHw== Newsgroups: microsoft.public.dotnet.framework.odbcnet Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.odbcnet:2973 NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166 X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet Unfortunately Not. As far as I know there is no FoxPro OleDb driver (please tell me where I can get it from if that is not the case) and the OleDb provider does not support the OleDb for ODBC driver. -----Original Message----- So, can you use the System.data.oledb provider to connect to the FoxPro file? Sincerely, Kevin Microsoft Support This posting is provided "AS IS" with no warranties, and confers no rights. Get Secure! - www.microsoft.com/security -------------------- | Content-Class: urn:content-classes:message | From: "Simon Jackson" simon.jackson (AT) alexismedical (DOT) co.uk | Sender: "Simon Jackson" simon.jackson (AT) alexismedical (DOT) co.uk | References: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl TvmVE3UcDHA.1928 (AT) cpmsftngxa06 (DOT) phx.gbl | Subject: RE: "System Error" using System.Data.OdbcDataAdapter in 1.1 DNF with Visual FoxPro | Date: Thu, 4 Sep 2003 05:06:07 -0700 | Lines: 108 | Message-ID: <0e6401c372dc$ec51c7e0$a101280a (AT) phx (DOT) gbl | MIME-Version: 1.0 | Content-Type: text/plain; | charset="iso-8859-1" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 | Thread-Index: AcNy3OxRTJD8YSR7RAqgmiveDdnzow== | Newsgroups: microsoft.public.dotnet.framework.odbcnet | Path: cpmsftngxa06.phx.gbl | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.odbcnet:2968 | NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161 | X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet | | Hi Kevin, | | The custId is a FoxPro numeric data type. When using the | adapter configuration wizard to create the command it maps | this to OdbcType.Decimal. | | Because the database is Visual FoxPro I'm using the | System.Data.Odbc provider to connect. | | Its wierd because if i set the database up in Access and | use the same code but with the MsJet4 OleDb data provider | instead of the Odbc provider it works? | | >-----Original Message----- | >What is the exact data type of the custId, string or | integer? | | >The following is a example for your reference: | | >===================== | >Private Function CreateDataAdapterDeleteCommand() As | OleDbCommand | > Dim strSQL As String | > strSQL = "DELETE FROM [Order Details] " & _ | > " WHERE OrderID = ? AND ProductID = ? | AND " & _ | > " Quantity = ? AND UnitPrice = ?" | > Dim cmd As New OleDbCommand(strSQL, cn) | | > Dim pc As OleDbParameterCollection = cmd.Parameters | > Dim param As OleDbParameter | > pc.Add("OrderID", OleDbType.Integer, 0, "OrderID") | > param.SourceVersion = DataRowVersion.Original | > pc.Add("ProductID", OleDbType.Integer, 0, "ProductID") | > param.SourceVersion = DataRowVersion.Original | > pc.Add("Quantity", OleDbType.SmallInt, 0, "Quantity") | > param.SourceVersion = DataRowVersion.Original | > pc.Add("UnitPrice", OleDbType.Currency, | 0, "UnitPrice") | > param.SourceVersion = DataRowVersion.Original | | > Return cmd | >End Function | >====================== | | >Sincerely, | | >Kevin | >Microsoft Support | | >This posting is provided "AS IS" with no warranties, and | confers no rights. | >Get Secure! - www.microsoft.com/security | | >-------------------- | >| Content-Class: urn:content-classes:message | >| From: "Simon Jackson" | <simon.jackson (AT) alexismedical (DOT) co.uk | >| Sender: "Simon Jackson" | <simon.jackson (AT) alexismedical (DOT) co.uk | >| Subject: "System Error" using | System.Data.OdbcDataAdapter in 1.1 DNF with | >Visual FoxPro | >| Date: Fri, 29 Aug 2003 06:33:38 -0700 | >| Lines: 22 | >| Message-ID: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl | >| MIME-Version: 1.0 | >| Content-Type: text/plain; | >| charset="iso-8859-1" | >| Content-Transfer-Encoding: 7bit | >| X-Newsreader: Microsoft CDO for Windows 2000 | >| Thread-Index: AcNuMid5xGgOVZ8FRTCED2QPp0qu3w== | >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 | >| Newsgroups: microsoft.public.dotnet.framework.odbcnet | >| Path: cpmsftngxa06.phx.gbl | >| Xref: cpmsftngxa06.phx.gbl | microsoft.public.dotnet.framework.odbcnet:2952 | >| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 | >| X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet | >| | >| Does anyone know why when I execute the following code | on | >| the 1.1 dot net framework I receive an OdbcException | with | >| description "System Error". | >| | >| Public Sub DeleteCustomer(custId As Integer) | >| | >| 'Use connection configured using the form designer | >| Dim FoxCmd As New OdbcCommand("delete from customers | >| where id = ?", FoxCnn) | >| | >| FoxCmd.CommandType = CommandType.Text | >| FoxCmd.Parameters.Add("id", OdbcType.Decimal) | >| FoxCmd.Parameters("id").Value = custId | >| | >| Try | >| FoxCnn.Open() | >| FoxCmd.ExecuteNonQuery() | >| Finally | >| FoxCnn.Close() | >| End Try | >| | >| End Sub | >| | | >. | | . |
#5
| |||
| |||
|
|
Content-Class: urn:content-classes:message From: "Simon Jackson" <simon.jackson (AT) alexismedical (DOT) co.uk Sender: "Simon Jackson" <simon.jackson (AT) alexismedical (DOT) co.uk References: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl TvmVE3UcDHA.1928 (AT) cpmsftngxa06 (DOT) phx.gbl |
|
Subject: RE: "System Error" using System.Data.OdbcDataAdapter in 1.1 DNF with Visual FoxPro Date: Tue, 9 Sep 2003 03:22:21 -0700 Lines: 250 Message-ID: <535501c376bc$40ffeff0$a601280a (AT) phx (DOT) gbl MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcN2vED9F8ntDm3ASPOm76/YMa4AWA== Newsgroups: microsoft.public.dotnet.framework.odbcnet Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.odbcnet:2978 NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166 X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet Thanks for taking the time to look at this Kevin. I've spoken to our FoxPro guy and it seems that the ID (sequential) field option is new to Fox 8. Unfortunately we are using Fox 6 and currently have no plans to upgrade as SQL Server is our company platform and we just have a few legacy apps in Fox 6 that are still being maintained. Ultimately these apps will be migrated to SQL Server & .Net so its not a huge problem if we cant get the Odbc provider to work in this context. -----Original Message----- Create a new FoxPro table with ID field, does the same problem occur? In the meantime, I am trying to reproduce the same problem on my side and will let you know the test result. Sincerely, Kevin Microsoft Support This posting is provided "AS IS" with no warranties, and confers no rights. Get Secure! - www.microsoft.com/security -------------------- | Content-Class: urn:content-classes:message | From: "Simon Jackson" simon.jackson (AT) alexismedical (DOT) co.uk | Sender: "Simon Jackson" simon.jackson (AT) alexismedical (DOT) co.uk | References: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl TvmVE3UcDHA.1928 (AT) cpmsftngxa06 (DOT) phx.gbl 0e6401c372dc$ec51c7e0$a101280a (AT) phx (DOT) gbl bN6xBo5cDHA.2244 (AT) cpmsftngxa06 (DOT) phx.gbl | Subject: RE: "System Error" using System.Data.OdbcDataAdapter in 1.1 DNF with Visual FoxPro | Date: Fri, 5 Sep 2003 04:34:16 -0700 | Lines: 171 | Message-ID: <2a8501c373a1$a35e48e0$a601280a (AT) phx (DOT) gbl | MIME-Version: 1.0 | Content-Type: text/plain; | charset="iso-8859-1" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 | Thread-Index: AcNzoaNepYcGZQ0oRqKbtv3MsJKYHw== | Newsgroups: microsoft.public.dotnet.framework.odbcnet | Path: cpmsftngxa06.phx.gbl | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.odbcnet:2973 | NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166 | X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet | | Unfortunately Not. As far as I know there is no FoxPro | OleDb driver (please tell me where I can get it from if | that is not the case) and the OleDb provider does not | support the OleDb for ODBC driver. | | | >-----Original Message----- | >So, can you use the System.data.oledb provider to connect | to the FoxPro | >file? | | >Sincerely, | | >Kevin | >Microsoft Support | | >This posting is provided "AS IS" with no warranties, and | confers no rights. | >Get Secure! - www.microsoft.com/security | | >-------------------- | >| Content-Class: urn:content-classes:message | >| From: "Simon Jackson" | <simon.jackson (AT) alexismedical (DOT) co.uk | >| Sender: "Simon Jackson" | <simon.jackson (AT) alexismedical (DOT) co.uk | >| References: <0b5301c36e32$2779f4f0$a501280a (AT) phx (DOT) gbl | ><TvmVE3UcDHA.1928 (AT) cpmsftngxa06 (DOT) phx.gbl | >| Subject: RE: "System Error" using | System.Data.OdbcDataAdapter in 1.1 DNF | >with Visual FoxPro | >| Date: Thu, 4 Sep 2003 05:06:07 -0700 | >| Lines: 108 | >| Message-ID: <0e6401c372dc$ec51c7e0$a101280a (AT) phx (DOT) gbl | >| MIME-Version: 1.0 | >| Content-Type: text/plain; | >| charset="iso-8859-1" | >| Content-Transfer-Encoding: 7bit | >| X-Newsreader: Microsoft CDO for Windows 2000 | >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 | >| Thread-Index: AcNy3OxRTJD8YSR7RAqgmiveDdnzow== | >| Newsgroups: microsoft.public.dotnet.framework.odbcnet | >| Path: cpmsftngxa06.phx.gbl | >| Xref: cpmsftngxa06.phx.gbl | microsoft.public.dotnet.framework.odbcnet:2968 | >| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161 | >| X-Tomcat-NG: microsoft.public.dotnet.framework.odbcnet | >| | >| Hi Kevin, | >| | >| The custId is a FoxPro numeric data type. When using | the | >| adapter configuration wizard to create the command it | maps | >| this to OdbcType.Decimal. | >| | >| Because the database is Visual FoxPro I'm using the | >| System.Data.Odbc provider to connect. | >| | >| Its wierd because if i set the database up in Access | and | >| use the same code but with the MsJet4 OleDb data | provider | >| instead of the Odbc provider it works? | >| | >| >-----Original Message----- | >| >What is the exact data type of the custId, string or | >| integer? | >| | >| >The following is a example for your reference: | >| | >| >===================== | >| >Private Function CreateDataAdapterDeleteCommand() As | >| OleDbCommand | >| > Dim strSQL As String | >| > strSQL = "DELETE FROM [Order Details] " & _ | >| > " WHERE OrderID = ? AND ProductID = ? | >| AND " & _ | >| > " Quantity = ? AND UnitPrice = ?" | >| > Dim cmd As New OleDbCommand(strSQL, cn) | >| | >| > Dim pc As OleDbParameterCollection = cmd.Parameters | >| > Dim param As OleDbParameter | >| > pc.Add("OrderID", OleDbType.Integer, 0, "OrderID") | >| > param.SourceVersion = DataRowVersion.Original | >| > pc.Add("ProductID", OleDbType.Integer, | 0, "ProductID") | >| > param.SourceVersion = DataRowVersion.Original | >| > pc.Add("Quantity", OleDbType.SmallInt, | 0, "Quantity") | >| > param.SourceVersion = DataRowVersion.Original | >| > pc.Add("UnitPrice", OleDbType.Currency, | >| 0, "UnitPrice") | >| > param.SourceVersion = DataRowVersion.Original | >| | >| > Return cmd | >| >End Function | >| >====================== | >| | >| >Sincerely, | >| | >| >Kevin | >| >Microsoft Support | >| | >| >This posting is provided "AS IS" with no warranties, | and | >| confers no rights. | >| >Get Secure! - www.microsoft.com/security | >| | >| >-------------------- | >| >| Content-Class: urn:content-classes:message | >| >| From: "Simon Jackson" | >| <simon.jackson (AT) alexismedical (DOT) co.uk | >| >| Sender: "Simon Jackson" | >| <simon.jackson (AT) alexismedical (DOT) co.uk | >| >| Subject: "System Error" using | >| System.Data.OdbcDataAdapter in 1.1 DNF with | >| >Visual FoxPro | >| >| Date: Fri, 29 Aug 2003 06:33:38 -0700 | >| >| Lines: 22 | >| >| Message-ID: <0b5301c36e32$2779f4f0 $a501280a (AT) phx (DOT) gbl | >| >| MIME-Version: 1.0 | >| >| Content-Type: text/plain; | >| >| charset="iso-8859-1" | >| >| Content-Transfer-Encoding: 7bit | >| >| X-Newsreader: Microsoft CDO for Windows 2000 | >| >| Thread-Index: AcNuMid5xGgOVZ8FRTCED2QPp0qu3w== | >| >| X-MimeOLE: Produced By Microsoft MimeOLE | V5.50.4910.0300 | >| >| Newsgroups: microsoft.public.dotnet.framework.odbcnet | >| >| Path: cpmsftngxa06.phx.gbl | >| >| Xref: cpmsftngxa06.phx.gbl | >| microsoft.public.dotnet.framework.odbcnet:2952 | >| >| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 | >| >| X-Tomcat-NG: | microsoft.public.dotnet.framework.odbcnet | >| >| | >| >| Does anyone know why when I execute the following | code | >| on | >| >| the 1.1 dot net framework I receive an OdbcException | >| with | >| >| description "System Error". | >| >| | >| >| Public Sub DeleteCustomer(custId As Integer) | >| >| | >| >| 'Use connection configured using the form designer | >| >| Dim FoxCmd As New OdbcCommand("delete from | customers | >| >| where id = ?", FoxCnn) | >| >| | >| >| FoxCmd.CommandType = CommandType.Text | >| >| FoxCmd.Parameters.Add("id", OdbcType.Decimal) | >| >| FoxCmd.Parameters("id").Value = custId | >| >| | >| >| Try | >| >| FoxCnn.Open() | >| >| FoxCmd.ExecuteNonQuery() | >| >| Finally | >| >| FoxCnn.Close() | >| >| End Try | >| >| | >| >| End Sub | >| >| | >| | >| >. | >| | >| | | >. | | . |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |