Click here to Skip to main content
15,904,023 members
Home / Discussions / Database
   

Database

 
GeneralI got it working, not sure it will always work Pin
jkirkerx29-Dec-16 9:23
professionaljkirkerx29-Dec-16 9:23 
I think I finally got the code correct to delete the records by customer number and invoice, guess I should run 1 more test on it.
Maybe I just fixed the index file and now it works. Tired of working on this, not fun!
Dim dwXCode As Integer = registry_shared.read_HKCU_dataPath(m_path)
        Dim connString As String = "Provider=VFPOLEDB; Data Source=" & m_path & "; DELETED = FALSE;"

        Using connection As New System.Data.OleDb.OleDbConnection(connString)
            Dim c1 As New System.Data.OleDb.OleDbCommand("SET EXCLUSIVE ON", connection)
            Dim c2 As New System.Data.OleDb.OleDbCommand("SET DELETED ON", connection)
            Dim c3 As New System.Data.OleDb.OleDbCommand("DELETE FROM ARTRS01H WHERE FCUSTNO = ? AND FINVNO = ?", connection)
            Dim c4 As New System.Data.OleDb.OleDbCommand("DELETE FROM ARTRS01 WHERE FCUSTNO = ? AND FINVNO = ?", connection)
            Dim c5 As New System.Data.OleDb.OleDbCommand("PACK", connection)

            c3.Parameters.Add("@FCUSTNO", OleDbType.VarChar).Value = pCustNo
            c3.Parameters.Add("@FINVNO", OleDbType.VarChar).Value = pInvNo

            c4.Parameters.Add("@FCUSTNO", OleDbType.VarChar).Value = pCustNo
            c4.Parameters.Add("@FINVNO", OleDbType.VarChar).Value = pInvNo

            Try
                connection.Open()
                c1.ExecuteNonQuery()
                c2.ExecuteNonQuery()
                Dim x As Integer = c3.ExecuteNonQuery()
                x += c4.ExecuteNonQuery()
                c5.ExecuteNonQuery()
                pValue.Result = If(x > 0, True, False)
                pValue.Message = x & " record(s) were deleted successfully"

            Catch sqlEx As SqlClient.SqlException
                pValue.Result = False
                pValue.Message = sqlEx.Message.ToString

            Catch exdb As OleDb.OleDbException
                pValue.Result = False
                pValue.Message = exdb.Message.ToString

            Catch ex As Exception
                pValue.Result = False
                pValue.Message = ex.Message.ToString

            Finally
                connection.Close()

            End Try
21st Century Globalism has become Socialism on a planetary scale, in which the unequal treaties of the past have come back into play.

QuestionUpdating a FoxPro dbf file using VB.net Pin
jkirkerx22-Dec-16 11:32
professionaljkirkerx22-Dec-16 11:32 
AnswerRe: Updating a FoxPro dbf file using VB.net Pin
jkirkerx22-Dec-16 11:37
professionaljkirkerx22-Dec-16 11:37 
AnswerRe: Updating a FoxPro dbf file using VB.net Pin
jschell26-Dec-16 7:17
jschell26-Dec-16 7:17 
GeneralRe: Updating a FoxPro dbf file using VB.net Pin
jkirkerx27-Dec-16 7:09
professionaljkirkerx27-Dec-16 7:09 
QuestionDrop & Recreate the DB Pin
Kevin Marois21-Dec-16 12:48
professionalKevin Marois21-Dec-16 12:48 
AnswerRe: Drop & Recreate the DB Pin
Chris Quinn21-Dec-16 22:03
Chris Quinn21-Dec-16 22:03 
GeneralRe: Drop & Recreate the DB Pin
Kevin Marois22-Dec-16 4:37
professionalKevin Marois22-Dec-16 4:37 
QuestionRe: Drop & Recreate the DB Pin
Richard MacCutchan22-Dec-16 4:59
mveRichard MacCutchan22-Dec-16 4:59 
AnswerRe: Drop & Recreate the DB Pin
Kevin Marois22-Dec-16 4:59
professionalKevin Marois22-Dec-16 4:59 
AnswerRe: Drop & Recreate the DB Pin
Simon_Whale22-Dec-16 5:49
Simon_Whale22-Dec-16 5:49 
GeneralRe: Drop & Recreate the DB Pin
Kevin Marois22-Dec-16 5:54
professionalKevin Marois22-Dec-16 5:54 
QuestionSQL 2012 Restore Problem Pin
Kevin Marois21-Dec-16 4:46
professionalKevin Marois21-Dec-16 4:46 
AnswerRe: SQL 2012 Restore Problem Pin
Richard Deeming21-Dec-16 6:00
mveRichard Deeming21-Dec-16 6:00 
GeneralRe: SQL 2012 Restore Problem Pin
Kevin Marois21-Dec-16 6:02
professionalKevin Marois21-Dec-16 6:02 
Questionerror occurred while enabling mars for this connection Pin
Travelthrprog18-Dec-16 7:56
Travelthrprog18-Dec-16 7:56 
AnswerRe: error occurred while enabling mars for this connection Pin
Eddy Vluggen21-Dec-16 4:52
professionalEddy Vluggen21-Dec-16 4:52 
QuestionTrying to access ReadWrite and ReadOnly variables in Script Component's ProcessInputRow Pin
indian14310-Dec-16 14:35
indian14310-Dec-16 14:35 
QuestionJet OLE, multiple joins with a union, missing an operator or brackets Pin
jkirkerx9-Dec-16 6:16
professionaljkirkerx9-Dec-16 6:16 
AnswerRe: Jet OLE, multiple joins with a union, missing an operator or brackets Pin
Eddy Vluggen9-Dec-16 7:08
professionalEddy Vluggen9-Dec-16 7:08 
GeneralRe: Jet OLE, multiple joins with a union, missing an operator or brackets Pin
jkirkerx13-Dec-16 9:14
professionaljkirkerx13-Dec-16 9:14 
QuestionRun SSIS Package using Microsoft.SqlServer.Dts.Runtime or Sql Server Jobs Pin
indian1436-Dec-16 9:05
indian1436-Dec-16 9:05 
AnswerRe: Run SSIS Package using Microsoft.SqlServer.Dts.Runtime or Sql Server Jobs Pin
ZurdoDev6-Dec-16 10:10
professionalZurdoDev6-Dec-16 10:10 
GeneralRe: Run SSIS Package using Microsoft.SqlServer.Dts.Runtime or Sql Server Jobs Pin
indian1436-Dec-16 10:51
indian1436-Dec-16 10:51 
AnswerRe: Run SSIS Package using Microsoft.SqlServer.Dts.Runtime or Sql Server Jobs Pin
CHill606-Dec-16 13:19
mveCHill606-Dec-16 13:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.