Click here to Skip to main content
15,915,501 members
Home / Discussions / Database
   

Database

 
AnswerRe: DELETE FROM ... not affecting the table? Pin
Andrew Peace30-Jan-02 11:35
Andrew Peace30-Jan-02 11:35 
GeneralRe: DELETE FROM ... not affecting the table? Pin
David Wulff31-Jan-02 4:15
David Wulff31-Jan-02 4:15 
GeneralRe: DELETE FROM ... not affecting the table? Pin
Andrew Peace3-Feb-02 13:39
Andrew Peace3-Feb-02 13:39 
GeneralRe: DELETE FROM ... not affecting the table? Pin
David Wulff3-Feb-02 14:16
David Wulff3-Feb-02 14:16 
GeneralRe: DELETE FROM ... not affecting the table? Pin
David Wulff10-Feb-02 8:00
David Wulff10-Feb-02 8:00 
GeneralRe: DELETE FROM ... not affecting the table? Pin
Andrew Peace10-Feb-02 8:45
Andrew Peace10-Feb-02 8:45 
GeneralRe: DELETE FROM ... not affecting the table? Pin
David Wulff10-Feb-02 8:56
David Wulff10-Feb-02 8:56 
GeneralRe: DELETE FROM ... not affecting the table? Pin
Andrew Peace10-Feb-02 9:11
Andrew Peace10-Feb-02 9:11 
Okay, seeing as I can't think of anything else I'll post some of my code, you might notice something perhaps.

This comes with the disclaimer that it's in VB and I don't usually do VB Smile | :) ;

Private ConnectionString As String
' Sets the filename of the database to open
'
' IN
' dbFileName - the filename of the database
Public Sub SetDatabaseFilename(dbFileName As String)
    ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbFileName
End Sub

' Opens the database
'
' IN
' OUT - a connection to the database - close with Connection.Close
Public Function OpenDatabase() As ADODB.Connection
    Dim adoconn As New ADODB.Connection
    
    ' DEBUG ONLY
    SetDatabaseFilename "C:\Documents and Settings\Administrator\My Documents\Main.mdb" 
    ' END DEBUG ONLY
    
    adoconn.Open ConnectionString
    Set OpenDatabase = adoconn
End Function
' Removes a customers's record from the database
'
' IN
' ID - ID of the customer record to be deleted
'
' OUT - success?
Public Function RemoveCustomer(ID As Integer) As Boolean
On Error GoTo Fail
    Dim adoconn As New ADODB.Connection
    Set adoconn = OpenDatabase
    
    adoconn.Execute "DELETE * FROM tblClients WHERE ID=" & ID
    
    adoconn.Close
    
    RemoveCustomer = True
    Exit Function
    
Fail:
    RemoveCustomer = False
    If IsObject(adoconn) Then
        adoconn.Close
    End If
End Function
For some reason it's taken out some of my blank lines, but anyway, hope that's useful.

--
Andrew.
GeneralRe: DELETE FROM ... not affecting the table? Pin
David Wulff10-Feb-02 10:49
David Wulff10-Feb-02 10:49 
AnswerRe: DELETE FROM ... not affecting the table? Pin
Matt Gullett10-Feb-02 9:04
Matt Gullett10-Feb-02 9:04 
GeneralRe: DELETE FROM ... not affecting the table? Pin
David Wulff10-Feb-02 10:00
David Wulff10-Feb-02 10:00 
GeneralSQL Authentication Pin
Mike Osbahr28-Jan-02 4:32
Mike Osbahr28-Jan-02 4:32 
Generalset Request Value option on the field ! Pin
Hadi Rezaee27-Jan-02 10:15
Hadi Rezaee27-Jan-02 10:15 
GeneralOLE-DB connection Pin
User 988527-Jan-02 7:01
User 988527-Jan-02 7:01 
QuestionCan you show me about SQL Server 7.0 Pin
25-Jan-02 7:39
suss25-Jan-02 7:39 
AnswerRe: Can you show me about SQL Server 7.0 Pin
Carlos Antollini25-Jan-02 7:51
Carlos Antollini25-Jan-02 7:51 
GeneralSpecifying a connection should use TCP/IP Pin
James T. Johnson24-Jan-02 12:23
James T. Johnson24-Jan-02 12:23 
GeneralRe: Specifying a connection should use TCP/IP Pin
AndyG26-Jan-02 8:22
AndyG26-Jan-02 8:22 
GeneralRe: Specifying a connection should use TCP/IP Pin
James T. Johnson26-Jan-02 19:44
James T. Johnson26-Jan-02 19:44 
GeneralCHAR, adVarWChar, CString Pin
David Pokluda22-Jan-02 21:12
David Pokluda22-Jan-02 21:12 
GeneralADO Data Control Pin
22-Jan-02 20:37
suss22-Jan-02 20:37 
Questionwhich data type responding to DBTYPE_DBTIMESTAMP? Pin
Aaron K.B. Huang18-Jan-02 2:17
Aaron K.B. Huang18-Jan-02 2:17 
AnswerRe: which data type responding to DBTYPE_DBTIMESTAMP? Pin
Konstantin Vasserman18-Jan-02 2:30
Konstantin Vasserman18-Jan-02 2:30 
GeneralRe: which data type responding to DBTYPE_DBTIMESTAMP? Pin
Aaron K.B. Huang18-Jan-02 21:56
Aaron K.B. Huang18-Jan-02 21:56 
GeneralMemory leak when connecting to an Excel data source usin ODBC Pin
Martin Fridegren15-Jan-02 3:33
Martin Fridegren15-Jan-02 3:33 

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.