忍者ブログ
6月18日設置
Posted by - 2025.03.04,Tue
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

Posted by No Name Ninja - 2007.07.22,Sun
Private Function hogeHashTable() As Boolean

  Dim ht As Hashtable
  Dim strKey As String
  Dim strArray As String()
  Dim strVal As String

  ht = New Hashtable

  strKey = "01"
  strArray = New String() {"japan", "nippon"}
  ht.Add(strKey, strArray)

  strKey = "02"
  strArray = New String() {"pen", "enpitsu"}
  ht.Add(strKey, strArray)

  If ht("01") Is Nothing Then
  Else
    strVal = CType(ht("01"), Array)(0)  'japan
    strVal = CType(ht("01"), Array)(1)  'nippon
  End If

  If ht("02") Is Nothing Then
  Else
    strVal = CType(ht("02"), Array)(0)  'pen
    strVal = CType(ht("02"), Array)(1)  'enpitsu
  End If

End Function
連想配列。結構使える。
PR
Posted by No Name Ninja - 2007.07.22,Sun

Imports System.Data.OleDb

Private Function hogeDb() As Boolean

Dim sqlConn As OleDbConnection
Dim strConn As String
Dim strSql As String
Dim sqlCmd As OleDbCommand
Dim sqlRec As OleDbDataReader
Dim strField As String

strConn = strConn & "Provider = hoge"
strConn = strConn & ";Data Source = hoge"
strConn = strConn & ";User Id = hoge"
strConn = strConn & ";Password = hoge"
strConn = strConn & ";"

sqlConn = New OleDbConnection
sqlConn.ConnectionString = strConn
sqlConn.Open()

strsql = "select * from hoge"
sqlCmd = New OleDbCommand
sqlCmd.CommandText = strSql
sqlCmd.Connection = sqlConn
sqlCmd.CommandTimeout = 10
sqlRec = sqlCmd.ExecuteReader

strField = sqlRec("FIELD")

sqlRec.Close()
sqlRec = Nothing
sqlCmd.Dispose()

sqlConn.Close()

End Function
Posted by No Name Ninja - 2007.07.22,Sun
Imports System.Xml

Private Function hoge() As Boolean

  Dim xDoc As XmlDocument = New XmlDocument
  Dim xNode As XmlNode
  Dim strUserId As String

  xDoc.Load("hoge.xml")
  xNode = xDoc.SelectSingleNode("CONFIG/CONNECT/USERID")
  strUserId = xNode.InnerText

End Function
XML結構扱いやすいね。
Posted by No Name Ninja - 2007.07.19,Thu
select
  a.name as テーブル名,
  a.id as テーブルid,
  b.name as 列名,
  b.xtype,
  c.name as データ型,
  b.length as サイズ,
  b.colid as 列順番
from
  (select name, id from sysobjects) a
  inner join
  (select name, id, xtype, length, colid from syscolumns) b
  on a.id = b.id
  inner join
  (select name, xusertype from systypes) c
  on b.xtype = c.xusertype
where
  a.name = @table
これで簡単な定義書作れそう。
カレンダー
02 2025/03 04
S M T W T F S
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
フリーエリア
最新コメント
[05/16 backlink service]
最新トラックバック
プロフィール
HN:
No Name Ninja
性別:
非公開
バーコード
ブログ内検索
カウンター
アクセス解析
Template by mavericyard*
Powered by "Samurai Factory"
忍者ブログ [PR]