19. März 2014 11:34
19. März 2014 11:38
19. März 2014 12:16
Markus Merkl hat geschrieben:'$' und '.' wird ersetzt durch '_' - wimre
HTH
19. März 2014 12:21
20. März 2014 14:20
Function GetNAVTableObjects() As DataTable
' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection
If My.Settings.NAVSQLAuth = "Database" Then
myConnection.ConnectionString = "server=" & My.Settings.NAVSQLServer & ";Trusted_Connection=False;database=" & My.Settings.NAVSQLDatabase & "User ID=" & My.Settings.NAVSQLUser & ";Password=" & My.Settings.NAVSQLPassword & ";"
'Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;
Else '"Windows"
myConnection.ConnectionString = "server=" & My.Settings.NAVSQLServer & ";Trusted_Connection=true;database=" & My.Settings.NAVSQLDatabase & ";"
End If
Dim myCommand As New SqlCommand
myCommand.CommandText = "SELECT [timestamp],[Type],[Company Name] as CompanyName,[ID],[Name],[Modified],[Compiled],[BLOB Reference] as BLOBReference,[BLOB Size] as BLOBSize,[DBM Table No_] as DBMTableNo,[Date],[Time],[Version List] as VersionList,[Locked],[Locked By] as LockedBy FROM [Object] where [Type]=0"
myCommand.Connection = myConnection
Dim da As New SqlDataAdapter
da.SelectCommand = myCommand
Dim ds As New DataSet
myConnection.Open()
da.Fill(ds, "object")
'myCommand.ExecuteNonQuery()
myConnection.Close()
'ds.WriteXml("navobjects_test.xml")
Return ds.Tables("object")
End Function
Function GetNAVTableName(NAVTableID As String) As String
Dim tablename As String = ""
Dim foundrows() As DataRow
foundrows = GetNAVTableObjects.Select("ID=" & NAVTableID)
If foundrows.Count = 0 Then
MsgBox("Tabelle " & NAVTableID & " nicht vorhanden")
Exit Function
End If
For Each row As DataRow In foundrows
If row("CompanyName").ToString.Length > 0 Then
If My.Settings.NAVCompany = row("CompanyName") Then
'Tabelle: Datapercompany=yes => tabellenname=Mandant$tabname
tablename = row("CompanyName") & "$" & row("Name")
Exit For
End If
Else
tablename = row("Name")
Exit For
End If
Next
Return tablename
End Function