Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2010 Can this be altered to allow it to be used as both a insert and update

$
0
0
Code:

    Public Sub AddItem(ByVal Model As String, ByVal Document As String, ByVal description As String, ByVal ByteSize As String, _
                      ByVal FileSize As String, ByVal Status As String, ByVal Location As String, ByVal Crc32 As String, _
                      ByVal FileName As String, ByVal StrManualType As String)

        'Create the command.
        Dim insertSQL As String = "INSERT INTO MyDataBase "
        insertSQL &= "(Model, Document, Description, ByteSize, FileSize, Status, Location, Crc32, FileName, Site)"
        insertSQL &= "VALUES (Model, Document, Description, ByteSize, FileSize, Status, Location, Crc32, FileName, StrManualType)"
        Dim List As New OleDb.OleDbCommand(insertSQL, Test)
        List.Parameters.AddWithValue("Model", Model)
        List.Parameters.AddWithValue("Document", Document)
        List.Parameters.AddWithValue("Description", Description)
        List.Parameters.AddWithValue("ByteSize", ByteSize)
        List.Parameters.AddWithValue("FileSize", FileSize)
        List.Parameters.AddWithValue("Status", Status)
        List.Parameters.AddWithValue("Location", Location)
        List.Parameters.AddWithValue("Crc32", Crc32)
        List.Parameters.AddWithValue("FileName", FileName)
        List.Parameters.AddWithValue("Site", StrManualType)

        Try
            List.ExecuteNonQuery()
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            'cn.Close()
        End Try

    End Sub


Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>