-->

2012年1月11日 星期三

ASP 判別回傳的rs是否沒有資料

ASP 判別回傳的rs是否沒有資料, 沒有就印出 "找不到任何資料"
 if  rs.eof and rs.bof then
 response.write "找不到任何資料 <br>"
 response.end
end if

設定透明度(相容於 ie / fx / chrome)

style="filter:alpha(opacity=50);-moz-opacity:0.5;opacity: 0.5;"

Javascript 偵測到按下[Enter] 鍵時, 就送出表單


<script src="jquery-1.7.1.min.js" ></script> <script language=javascript>  $(document).ready(function(){ $(document).keypress(function(event) { if ( event.which == 13 ) { $("#login").submit(); }    });  }); </script>

2011年11月16日 星期三

ASP.NET C# 從資料庫(MSSQL)讀出圖檔

cmd.CommandText = "SELECT  picture , filename FROM pic ";

SqlDataReader dr = cmd.ExecuteReader();

byte[] img = null;

while (dr.Read())
{
  MyData data = new MyData();

  img = (byte[]) dr["picture"];

  MemoryStream str = new MemoryStream();

  str.Write(img, 0, img.Length);

  Bitmap bit = new Bitmap(str);

  data.img = bit;

  data.filename = (string) dr["filename"];

  myDataList.Add(data);

}

ASP.NET C# 將檔圖存入資料庫(MSSQL)

        // 讀取二進制檔
        public byte[] ReadFile(string path)
        {

            byte[] data = null;

            FileInfo fInfo = new FileInfo(path);

            long length = fInfo.Length;

            FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read);

            BinaryReader br = new BinaryReader(fStream);

            data = br.ReadBytes((int)length);

            return data;

        }



// --讀取檔案轉成二進制字資料, 並存入資料庫裡--
imageData = ReadFile(k.ImageLocation);

// -- 新增資料的Sql語句 --
cmd.CommandText = "INSERT INTO pic ( filename, picture , in_time ) " +
" VALUES ( @imagePath, @imageData, @inTime ) ";

// --設定輸入參數--
cmd.Parameters.Add("@imagePath", SqlDbType.NVarChar).Value = k.Name;

cmd.Parameters.Add("@imageData", SqlDbType.Image).Value = imageData;

cmd.Parameters.Add("@inTime", SqlDbType.SmallDateTime).Value = DateTime.Now.Date;
// --設定輸入參數--

cmd.ExecuteNonQuery(); // 執行寫入作業

2011年8月18日 星期四

記錄不錯的網站連結

記錄不錯的網站連結

http://www.spps.tp.edu.tw/documents/memo/asp/asp.htm (中文ASP教學網站)

SQL Explorer 連接 DB2

最近一直在找Sql Explorer Ver 4.0 的新版本, 就找到了 sqlexplorer_rcp-3.6.1.win32.win32.x86-JRE 這
個版本, 下載點位置 執行sqlexplorer.exe 之後再去指定JDBC去連結那一個odbc名稱。


設定好後就按下OK鈕。


點擊ODBC_NAME 連接DB2 資料庫。