掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
mdbファイルの現在接続ユーザー数の取得 (ID:140766)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
いつもお世話になっております。 VB.NET(VB STUDIO2008) Windows VISTAの環境で でmdb(Access2003形式)のデータベースアプリを開発しようとしています。 mdbファイルを開けるのを 1度に1ユーザーに制限したいのです。 以前Access2000にて マイクロソフト技術情報から LDBファイルより接続ユーザー数を取得していました。 そのモジュールをそのままVB.NETにコピーしたのですが、 文法が違うのか 以下の2か所でエラーが発生します。 ・ReDim lpszUserBuffer(50) As String 変数が宣言されていません。 ・Cusers = LDBUser_GetUsers(lpszUserBuffer(), StrDbPath, 2) 引数lpszUserBuffer()の配列数を超えています 勉強不足のせいか修正方法がわかりません。 よろしくお願いいたします。 Declare Function LDBUser_GetUsers Lib "MSLDBUSR.DLL" _ (lpszUserBuffer() As String, ByVal lpszFilename As String, _ ByVal nOptions As Long) As Integer '-------------------------------------------------------------- '現在ユーザー使用ユーザー数取得 '1=今回の自分のみ '2以上=複数いる 'マイナス=エラー 'WindowsのSystem/System32にMSLDBUSR.DLLが必要です。 'http://www.friendlysw.com/knowhow/Forms_Intermediate_010.asp’ '-------------------------------------------------------------- Public Function GetUsers(Optional StrDbPath As String) As Integer ReDim lpszUserBuffer(50) As String Dim intLooper As Integer Dim Cusers As Long Dim strMsgBox As String Dim res As Integer res = -99 If IsMissing(StrDbPath) Or StrDbPath = "" Then StrDbPath = CurrentDb.name End If Cusers = LDBUser_GetUsers(lpszUserBuffer(), StrDbPath, 2) Select Case Cusers Case -1 strMsgBox = "Can't open the LDB file" Case -2 strMsgBox = "No user connected" Case -3 strMsgBox = "Can't Create an Array" Case -4 strMsgBox = "Can't redimension array" Case -5 strMsgBox = "Invalid argument passed" Case -6 strMsgBox = "Memory allocation error" Case -7 strMsgBox = "Bad index" Case -8 strMsgBox = "Out of memory" Case -9 strMsgBox = "Invalid Argument" Case -10 strMsgBox = "LDB is suspected as corrupted" Case -11 strMsgBox = "Invalid argument" Case -12 strMsgBox = "Unable to read MDB file" Case -13 strMsgBox = "Can't open the MDB file" Case -14 strMsgBox = "Can't find the LDB file" End Select res = Cusers Exit_GetUsers: GetUsers = res Exit Function Err_GetUsers: MsgBox Err.Description Resume Exit_GetUsers End Function
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.