Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo leute,

hab grad gesehn das ich in visual studio als projektkomponente ne lokale Datenbank hinzufügen kann. Gesagt getan. Hinzugefügt hab ich sie schon. Eingerichtet auch. Nur Connecten will er mich nicht lassen. Da es ein "SQL server Compact Edition Database File" ist, habe ich es natürlich mit ner sql connection versucht. Als dies fehlschlug versuchte ich es noch mit der olEdb. Dies scheiterte auch. Hat jemand schon mit dieser art von Komponente erfahrung gesammelt?

Ich war immer der Meinung das man nur auf eine sql Datenbank connecten kann solange diese unter einem sql Server läuft.

lg

simon

  • Autor
stichworte sqlceengine und sqlceconnection (sry hab den thread iwie übersehen bis jetzt) ;)

Kein Thema :D

Ja ich weiß schon das ich das mit sqlce machen muss nur klappt es nicht und ich weiß nicht warum, da er mir keinen fehler wirft. Es ist also ein logischer Fehler eventuell könnt ihr mal über folgende passage drüberfliegen ;) .

Per folderbrowserDialog (hier playlist) soll ein Ordner ausgewählt werden und in diesem wird dann nach Dateien mit der endung *.wav gesucht. Diese sollen dann in die lokale Datenbank abgespeichert werden. Das dazu dienende Feld ist als image typ deklariert.


Dim con As New SqlServerCe.SqlCeConnection("Data Source=worklist.sdf")


  If Windows.Forms.DialogResult.OK Then

            Dim path As String

            path = playlist.SelectedPath

            For Each foundfile As String In My.Computer.FileSystem.GetFiles(path, FileIO.SearchOption.SearchAllSubDirectories, "*.wav")

                Dim title As String

               title = foundfile.Substring(foundfile.LastIndexOf("\") + 1)

                              //SPEICHERN


                If System.IO.File.Exists(foundfile) Then

                    Dim cmdMem As New SqlServerCe.SqlCeCommand

                    cmdMem.Connection = con

                    cmdMem.CommandText = "select * from complete"

                    Dim adpMem As Data.SqlServerCe.SqlCeDataAdapter = New SqlServerCe.SqlCeDataAdapter(cmdMem)


                    Dim builder As SqlServerCe.SqlCeCommandBuilder = New SqlServerCe.SqlCeCommandBuilder(adpMem)

                    builder.GetUpdateCommand()


                    Dim dsMem As New Data.DataSet

                    adpMem.Fill(dsMem)

                    Dim dtMem As Data.DataTable = dsMem.Tables(0)


                    If dtMem.Rows.Count > 0 Then

                        Dim Wr_Stream As New IO.FileStream(foundfile, IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite)

                        Dim sr As New IO.BinaryReader(Wr_Stream)

                        Dim f As New System.IO.FileInfo(foundfile)

                        Dim TempArray(f.Length - 1) As Byte

                        sr.Read(TempArray, 0, f.Length - 1)

                        sr.Close()

                        sr = Nothing

                        dtMem.Rows(0)("Titel") = title

                        dtMem.Rows(0)("Datei") = TempArray

                        adpMem.Update(dsMem)

                    Else

                        Dim Wr_Stream As New IO.FileStream(foundfile, IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite)

                        Dim sr As New IO.BinaryReader(Wr_Stream)

                        Dim f As New System.IO.FileInfo(foundfile)

                        Dim TempArray(f.Length - 1) As Byte

                        sr.Read(TempArray, 0, f.Length - 1)

                        sr.Close()

                        sr = Nothing

                        Dim dr As Data.DataRow

                        dr = dtMem.NewRow

                        dr("Titel") = title

                        dr("Datei") = TempArray

                        dtMem.Rows.Add(dr)

                        adpMem.Update(dtMem)

                    End If


                End If

danke,

simon

Ja ich weiß schon das ich das mit sqlce machen muss nur klappt es nicht und ich weiß nicht warum, da er mir keinen fehler wirft. Es ist also ein logischer Fehler eventuell könnt ihr mal über folgende passage drüberfliegen

was passiert denn, wenn du zeilenweise debuggst? sieh dir mal an, was in den einzelnen variablen drinsteht.

s'Amstel

  • Autor

hab ich gemacht, die taples sind leer :eek

versteh ich nicht. ich hab selbigen quellcode (nur eben statt ce den normalen sqlclient) schon benutzt um auf nen sql server (standart nicht compact) zuzugreifen und auch dateien reinzuschreiben.

Bearbeitet von Gateway_man

  • Autor

kann es sein das das problem eher daran liegt das die zu speichernden Dateien zu groß sind ? Bin hier mal auf ne interessante seite gestoßen die folgende nachteile von sql compact aufführt:

SQL Compact Edition (SQL CE) Limitations and Restrictions

* Unmanaged and not typesafe Win32 architecture

* No support for Views

* No support for Triggers

* No support for Stored Procedures or UDFs

* Cannot be used across a network or with ASP.Net

* TSQL Syntax support is greatly limited

* Does not support smalldatetime, image, xml, varchar(max), nvarchar(max), varbinary, char©, varchar(n) datatypes

* You cannot integrate CLR assemblies

* Cannot be used for web services / SOAP

* Maximum usage of 1 CPU

* No Full Text Search indexes

* No cross platform support

* No xcopy deployment of the data access assembly and database to both Windows and Mobile platforms. Requires distribution of a binary per mobile target.

* Database max size is constrained to 128MB by default unless you change your connection string to modify this limit

So kann mir jemand sagen ob diese informationen veraltet sind und ob sich da was dran verändert hat? leider ist der stand des vortrags nicht mit einem datum versehn.

Noch ein kleiner informationshappen:

Jede datei die ich einspeichern will hat ca eine größe von 3-4 Mb.

lg und schönen abend,

simon

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.