---
title: "Databas api"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/101059-databas-api"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "Thure"
published: "2004-04-06T13:39:37.000Z"
updated: "2004-04-06T21:16:51.000Z"
replies: 1
views: 255
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/101059-databas-api"
---

# Databas api

## #1 — Thure, 2004-04-06T13:39Z

Jag använder VB´s Data control för att koppla mig mot databaser, men jag skulle vilja ha ett api så jag slipper använda kontrollen (till dll filer). Är det någon som har nån kodsnutt att dela med sig av?

Tack på förhand 

Rickard

Permalänk: https://www.webforum.nu/p/101059

## #2 — PsyDonia, 2004-04-06T21:16Z

i referenser markerar du att använda.
Microsoft ActiveX Data Objects 2.5 Library

sen i koden gör du typ så här t.ex.

```
Dim Conn As New ADODB.Connection
Dim strConn As String

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Databas.mdb"

Conn.Open strConn

Dim RecSet As New ADODB.Recordset
Dim strSQL As String

strSQL = "SELECT * FROM Tabell"

RecSet.Open strSQL, Conn, adOpenStatic, adLockOptimistic
Dim i
i = 0
Do Until RecSet.EOF

        Text1(i).Text = RecSet!antal
        Text5(i).Text = RecSet!Date
        RecSet.Update
        

i = i + 1

RecSet.MoveNext
Loop

RecSet.Close
Conn.Close
Set RecSet = Nothing
Set Conn = Nothing
```

Permalänk: https://www.webforum.nu/p/1318007

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/101059-databas-api
