Lấy Version ClickOnce
ApplicationDeployment.CurrentDeployment.CurrentVersion
Thêm column cho table của access
OleDbConnection con = new OleDbConnection(connectionString);
con.Open();
try
{
string sql = "SELECT TOP 1 * FROM TableName";
OleDbDataAdapter da = new OleDbDataAdapter(sql, con);
DataTable table = new DataTable();
da.Fill(table);
int i = table.Columns.IndexOf(fileldName);
if (i == -1)
{
string sqlAdd = "ALTER Table TableName Add Column fileldName DataType(Leght)";
OleDbCommand cmd = new OleDbCommand(sqlAdd, con);
cmd.ExecuteNonQuery();
}
table.Dispose();
con.Close();
con.Dispose();
}
27.2.09
19.1.09
Lịch sử Việt nam
Lạc Long Quân vẩy đầy mình
Âu Cơ là vợ đẻ uỳnh trăm con
Đứa xuống biển đứa lên non
Những chuyện như thế éo còn ai tin
Triệu Đà tướng giỏi vãi lìn
Đánh nhau với cả quân mình Cổ Loa
Xây thành phải đợi tiếng gà
Thần rùa giúp đỡ dần dà cũng xong
An Dương Vương cứ khóc ròng
Mất nước chỉ tại thù trong giặc ngoài
Trọng Thủy là đứa bất tài
Mỵ Châu phải gọi là loài hiếu dâm
Bà Trưng nhịn nhục nỗi niềm
Vùng lên khởi nghĩa hấp diêm bọn Tàu
Nước mình độc lập chẳng lâu
Bọn Khựa nó lại lâu bâu xông vào
Lí Bí một đấng anh hào
Côn quyền hơn sức lược thao gồm tài
Có ông Hắc Đế họ Mai
Lịch sử em nắm cũng vài ý chung
Một nghìn năm sử lung tung
Thế rồi Nam Hán như sung chết đầy
Ngô Quyền học giỏi mưu hay
Chọc thủng tan nát một bày thuyền to
Nước mình tên gọi Đại Cồ
Việt từ ngày ấy họ Ngô nắm quyền
Mười hai quân sứ nổi điên
Có người đánh lộn kiếm tiền họ Đinh
Cờ lau từ thuở còn trinh
Binh đao từ thuở nước mình hỗn mang
Ninh Bình vua ở với quan
Hoa Lư thủ phủ trong hang to đùng
Hoang Tiền (Tiên Hoàng) chết lúc đang sung
Thái hậu thấy thế ngủ cùng họ Lê
Lê Hoàn sung sướng đê mê
Mặc bào ra trận bụng phê mắt lòi
Vua Lý thèm gái đi chơi
Tới khi ngẩng mặt lên trời thất kinh
Một con rồng múa linh tinh
Bởi vì mê tín triều đình dời đô
Một tay gây dựng cơ đồ
Phật là quốc đạo, Khổng Nho làm nền
Một hôm ở trong cái đền
Quốc sư Thường Kiệt rập rình Tống quân
Bắc loa rồi giả làm thần
“Nước Nam tao ở…” dần dần nói ra
Ăn rùa quân Tống cũng gà
Vội bê quần áo đệm ga đi về
Lý Thường Kiệt cười hề hề
Giọng tao thái giám ai chê nữa nào
Quả là trí tuệ trình cao
Việt quân sung sướng ào ào tiến lên
Họ Trần éo chịu được thêm
Mới đưa Trần Cảnh một đêm vào triều
Cùng công chúa Lý làm liều
Thôi thì hai cháu cũng yêu thật lòng
Nhà Lý vì thế đi tong
Sang triều vua mới thuộc dòng nhà tao
Họ Trần rất đỗi anh hào
Thăng Long bỏ ngỏ chui vào rừng sâu
Nguyên Mông thiếu đói khá lâu
Từ trong hang đá ta bâu ra đầy
Người Việt vốn tính bầy nhầy
Hỏi Trần Hưng đạo bậc thầy thái sư
Vua rằng: “Địch mạnh thế ư?”
Đạo rằng: “Thua cứ cắt… c* của thần”
Toàn dân khí thế vô ngần
Đánh giặc Mông Cổ ba lần nát tan
Quốc Toản bóp nát quả cam
Ống đồng thằng giặc Thoát Hoan chui vào
Xưa nay gì cứ cao trào
Thì ngay sau đó sẽ nhào xuống ngay
Hồ Quý Ly vốn cao tay
Tiếm quyền và nước non này về ta
Tây Đô Thanh Hóa là nhà
Thăng Long dek ở, rõ là thằng ngu…
Nhà Hồ thọ được mấy thu
Giặc Minh phương Bắc từ từ xâm lăng
Đầu người thì bị chặt phăng
Trai tù gái hiếp hờn căm ngút trời
Anh hùng xuất hiện kịp thời
Ở trong Thanh Hóa có người họ Lê
Biệt danh Lợi, nhóm máu dê
Nhân tài Nguyễn Trãi là bề tôi trung
Được cho gươm báu để dùng
Bởi vì người Việt thờ chung thần Rùa
Nhà vua câu cá với bồ
Tiện tay trả kiếm ở hồ Hoàn Gươm
Chỉ vì vua chết bất thường
Nguyễn Trãi phải khổ ba đường chu di
Trong vụ án vườn Lệ Chi
Người ngoài bán tín bán nghi nhiều phần
Công lao chúa Nguyễn lấn sân
Nước mình chiếm trọn địa phần miền Nam
Ngày xưa là đất của Cam
Pu chia với cả người Chàm Mút-xlim
Chiêu Thống bị giặc bóp chim
Phú xuân Nguyễn Huệ im lìm tiến quân
Đánh cho dài tóc vô ngần
Đánh cho răng nhuộm mười phần đều đen
Đánh cho Sĩ Nghị một phen
Hồn bay phách lạc, xác chen thành gò
Đống Đa cho tới Cửa Lò
Gió reo còn vẳng tiếng hò ba quân
Giặc xâm lược phải mút chân
Giặc vào giặc phải liếm phân nước mình
Giặc Thanh giặc Tống giặc Minh
Nam tiến đều bị mất chân mất đầu
Quang Trung vua sống chẳng lâu
Thì đùng một cái đi chầu bên kia…
Ngọc Hân công chúa đầm đìa
Chàng ơi sao lại say bia đánh lộn?
Các chúa nhà Nguyễn cũng khôn
Dần dần dẹp Trịnh ôn tồn tiến lên
Việt Nam quốc hiệu đặt tên
Miền Trung ở Huế xây nên kinh thành
Bấy giờ thiên hạ nổi danh
Một người thơ phú rất rành tên Du
Viết ra một quyển dâm thư
Tên nhân vật chính hình như là Kiều
Gần xa ân ái cũng nhiều
Tài hoa xinh đẹp lại chiều khách chơi
Đọc Kiều mới hiểu kiếp người
Ngẫm ra càng thấy cuộc đời xấu xa
Đau đớn thay phận đàn bà
Than rằng bạc mệnh cũng là lời chung
Nam Kỳ dân trồng cây bông
Gòn ở một chỗ là sông Sài Gòn
Hòa bình phủ khắp nước non
Các cha truyền đạo lon ton chạy vào
Tây Ban cho tới Bồ Đào
Toàn người da trắng to cao ch… dài
Có ông đờ Rốt thật tài
Nghĩ ra quốc ngữ mấy bài đầu tiên
Dân Nam sung sướng như điên
Từ nay éo phải bút nghiên chữ Tàu
A bê xê thuộc làu làu
Thánh hiền chữ Hán vò nhàu vứt đi
Vào năm êi-tin-fíf-ty-…
Êit người Pháp đến không đi về nhà (1858)
Bắn nhau bán đảo Sơn Trà
Pháp là đại bác, Việt là cung tên
Chịu thua vua Nguyễn kí tên
Nhượng cho sáu tỉnh ở miền Đông Nam
Nước mình thành nước An Nam
Bị Pháp đô hộ lại càng khó khăn
Gần xa trí thức băn khoăn
Bao giờ mới hết liếm ch.. nước ngoài
Bội Châu thỉnh thoảng viết bài
Thơ ca yêu giống yêu loài ghét Tây
Đông Du phong trào rất hay
Thanh niên du học càng ngày càng đông
Hoàng Hoa Thám giỏi võ công
Mùa xuân khởi nghĩa, mùa đông mất đầu
Thế kỷ mười chín u sầu
Anh hùng giải phóng kiếm đâu bây giờ?
Năm đó giáng thế bác Hồ
Thiên văn phỏng đoán cơ đồ sẽ nên
Sinh Cung họ Nguyễn là tên
Nam Đàn là huyện, Kim Liên là phường
Nghệ An là đất quê hương
Trình độ Hán học tương đương người Tàu
Tây phương văn hóa hiểu sâu
Châu Phi đã trải, châu Âu đã từng
Yêu dân thương nước vô cùng
Năm hai mốt tuổi đùng đùng đi Tây
Quyết tâm học lấy điều hay
Mỗi ngày Bác viết lên tay mười từ
Bao lần vào tội ra tù
Bao lần Bác vẫn cười trừ kẻ gian
Ví không có cảnh đông tàn
Thì đâu có cảnh huy hoàng ngày xuân
Nghĩ mình trong lúc gian truân
Tai ương rèn luyện tinh thần thêm hăng
Paris Bác ở Công Poăng
Ngày thì quét tuyết đêm chăm học bài
Lênin cương luận rất dài
Bác đọc Bác hiểu một vài ý chung
Học xong Nin-Mác Bác bùng
Nồi xoong quần áo chăn mùng Bác đi
Thế rồi Bác bị tình nghi
Tàu Tưởng bắt Bác mong chi ngày về
Nhưng nhờ nghị lực tràn trề
Đến năm bốn mốt Bác về Việt Nam
Lúc đầu Bác ở trong hang
Bẻ cây phá đá làm bàn Bác ghi
Vui chơi sung sướng tùy nghi
Sáng ra bờ suối tối thì vào hang
Rau măng cháo bẹ sẵn sàng
Cuộc đời cách mạng thật sang thật giàu…
Âu Cơ là vợ đẻ uỳnh trăm con
Đứa xuống biển đứa lên non
Những chuyện như thế éo còn ai tin
Triệu Đà tướng giỏi vãi lìn
Đánh nhau với cả quân mình Cổ Loa
Xây thành phải đợi tiếng gà
Thần rùa giúp đỡ dần dà cũng xong
An Dương Vương cứ khóc ròng
Mất nước chỉ tại thù trong giặc ngoài
Trọng Thủy là đứa bất tài
Mỵ Châu phải gọi là loài hiếu dâm
Bà Trưng nhịn nhục nỗi niềm
Vùng lên khởi nghĩa hấp diêm bọn Tàu
Nước mình độc lập chẳng lâu
Bọn Khựa nó lại lâu bâu xông vào
Lí Bí một đấng anh hào
Côn quyền hơn sức lược thao gồm tài
Có ông Hắc Đế họ Mai
Lịch sử em nắm cũng vài ý chung
Một nghìn năm sử lung tung
Thế rồi Nam Hán như sung chết đầy
Ngô Quyền học giỏi mưu hay
Chọc thủng tan nát một bày thuyền to
Nước mình tên gọi Đại Cồ
Việt từ ngày ấy họ Ngô nắm quyền
Mười hai quân sứ nổi điên
Có người đánh lộn kiếm tiền họ Đinh
Cờ lau từ thuở còn trinh
Binh đao từ thuở nước mình hỗn mang
Ninh Bình vua ở với quan
Hoa Lư thủ phủ trong hang to đùng
Hoang Tiền (Tiên Hoàng) chết lúc đang sung
Thái hậu thấy thế ngủ cùng họ Lê
Lê Hoàn sung sướng đê mê
Mặc bào ra trận bụng phê mắt lòi
Vua Lý thèm gái đi chơi
Tới khi ngẩng mặt lên trời thất kinh
Một con rồng múa linh tinh
Bởi vì mê tín triều đình dời đô
Một tay gây dựng cơ đồ
Phật là quốc đạo, Khổng Nho làm nền
Một hôm ở trong cái đền
Quốc sư Thường Kiệt rập rình Tống quân
Bắc loa rồi giả làm thần
“Nước Nam tao ở…” dần dần nói ra
Ăn rùa quân Tống cũng gà
Vội bê quần áo đệm ga đi về
Lý Thường Kiệt cười hề hề
Giọng tao thái giám ai chê nữa nào
Quả là trí tuệ trình cao
Việt quân sung sướng ào ào tiến lên
Họ Trần éo chịu được thêm
Mới đưa Trần Cảnh một đêm vào triều
Cùng công chúa Lý làm liều
Thôi thì hai cháu cũng yêu thật lòng
Nhà Lý vì thế đi tong
Sang triều vua mới thuộc dòng nhà tao
Họ Trần rất đỗi anh hào
Thăng Long bỏ ngỏ chui vào rừng sâu
Nguyên Mông thiếu đói khá lâu
Từ trong hang đá ta bâu ra đầy
Người Việt vốn tính bầy nhầy
Hỏi Trần Hưng đạo bậc thầy thái sư
Vua rằng: “Địch mạnh thế ư?”
Đạo rằng: “Thua cứ cắt… c* của thần”
Toàn dân khí thế vô ngần
Đánh giặc Mông Cổ ba lần nát tan
Quốc Toản bóp nát quả cam
Ống đồng thằng giặc Thoát Hoan chui vào
Xưa nay gì cứ cao trào
Thì ngay sau đó sẽ nhào xuống ngay
Hồ Quý Ly vốn cao tay
Tiếm quyền và nước non này về ta
Tây Đô Thanh Hóa là nhà
Thăng Long dek ở, rõ là thằng ngu…
Nhà Hồ thọ được mấy thu
Giặc Minh phương Bắc từ từ xâm lăng
Đầu người thì bị chặt phăng
Trai tù gái hiếp hờn căm ngút trời
Anh hùng xuất hiện kịp thời
Ở trong Thanh Hóa có người họ Lê
Biệt danh Lợi, nhóm máu dê
Nhân tài Nguyễn Trãi là bề tôi trung
Được cho gươm báu để dùng
Bởi vì người Việt thờ chung thần Rùa
Nhà vua câu cá với bồ
Tiện tay trả kiếm ở hồ Hoàn Gươm
Chỉ vì vua chết bất thường
Nguyễn Trãi phải khổ ba đường chu di
Trong vụ án vườn Lệ Chi
Người ngoài bán tín bán nghi nhiều phần
Công lao chúa Nguyễn lấn sân
Nước mình chiếm trọn địa phần miền Nam
Ngày xưa là đất của Cam
Pu chia với cả người Chàm Mút-xlim
Chiêu Thống bị giặc bóp chim
Phú xuân Nguyễn Huệ im lìm tiến quân
Đánh cho dài tóc vô ngần
Đánh cho răng nhuộm mười phần đều đen
Đánh cho Sĩ Nghị một phen
Hồn bay phách lạc, xác chen thành gò
Đống Đa cho tới Cửa Lò
Gió reo còn vẳng tiếng hò ba quân
Giặc xâm lược phải mút chân
Giặc vào giặc phải liếm phân nước mình
Giặc Thanh giặc Tống giặc Minh
Nam tiến đều bị mất chân mất đầu
Quang Trung vua sống chẳng lâu
Thì đùng một cái đi chầu bên kia…
Ngọc Hân công chúa đầm đìa
Chàng ơi sao lại say bia đánh lộn?
Các chúa nhà Nguyễn cũng khôn
Dần dần dẹp Trịnh ôn tồn tiến lên
Việt Nam quốc hiệu đặt tên
Miền Trung ở Huế xây nên kinh thành
Bấy giờ thiên hạ nổi danh
Một người thơ phú rất rành tên Du
Viết ra một quyển dâm thư
Tên nhân vật chính hình như là Kiều
Gần xa ân ái cũng nhiều
Tài hoa xinh đẹp lại chiều khách chơi
Đọc Kiều mới hiểu kiếp người
Ngẫm ra càng thấy cuộc đời xấu xa
Đau đớn thay phận đàn bà
Than rằng bạc mệnh cũng là lời chung
Nam Kỳ dân trồng cây bông
Gòn ở một chỗ là sông Sài Gòn
Hòa bình phủ khắp nước non
Các cha truyền đạo lon ton chạy vào
Tây Ban cho tới Bồ Đào
Toàn người da trắng to cao ch… dài
Có ông đờ Rốt thật tài
Nghĩ ra quốc ngữ mấy bài đầu tiên
Dân Nam sung sướng như điên
Từ nay éo phải bút nghiên chữ Tàu
A bê xê thuộc làu làu
Thánh hiền chữ Hán vò nhàu vứt đi
Vào năm êi-tin-fíf-ty-…
Êit người Pháp đến không đi về nhà (1858)
Bắn nhau bán đảo Sơn Trà
Pháp là đại bác, Việt là cung tên
Chịu thua vua Nguyễn kí tên
Nhượng cho sáu tỉnh ở miền Đông Nam
Nước mình thành nước An Nam
Bị Pháp đô hộ lại càng khó khăn
Gần xa trí thức băn khoăn
Bao giờ mới hết liếm ch.. nước ngoài
Bội Châu thỉnh thoảng viết bài
Thơ ca yêu giống yêu loài ghét Tây
Đông Du phong trào rất hay
Thanh niên du học càng ngày càng đông
Hoàng Hoa Thám giỏi võ công
Mùa xuân khởi nghĩa, mùa đông mất đầu
Thế kỷ mười chín u sầu
Anh hùng giải phóng kiếm đâu bây giờ?
Năm đó giáng thế bác Hồ
Thiên văn phỏng đoán cơ đồ sẽ nên
Sinh Cung họ Nguyễn là tên
Nam Đàn là huyện, Kim Liên là phường
Nghệ An là đất quê hương
Trình độ Hán học tương đương người Tàu
Tây phương văn hóa hiểu sâu
Châu Phi đã trải, châu Âu đã từng
Yêu dân thương nước vô cùng
Năm hai mốt tuổi đùng đùng đi Tây
Quyết tâm học lấy điều hay
Mỗi ngày Bác viết lên tay mười từ
Bao lần vào tội ra tù
Bao lần Bác vẫn cười trừ kẻ gian
Ví không có cảnh đông tàn
Thì đâu có cảnh huy hoàng ngày xuân
Nghĩ mình trong lúc gian truân
Tai ương rèn luyện tinh thần thêm hăng
Paris Bác ở Công Poăng
Ngày thì quét tuyết đêm chăm học bài
Lênin cương luận rất dài
Bác đọc Bác hiểu một vài ý chung
Học xong Nin-Mác Bác bùng
Nồi xoong quần áo chăn mùng Bác đi
Thế rồi Bác bị tình nghi
Tàu Tưởng bắt Bác mong chi ngày về
Nhưng nhờ nghị lực tràn trề
Đến năm bốn mốt Bác về Việt Nam
Lúc đầu Bác ở trong hang
Bẻ cây phá đá làm bàn Bác ghi
Vui chơi sung sướng tùy nghi
Sáng ra bờ suối tối thì vào hang
Rau măng cháo bẹ sẵn sàng
Cuộc đời cách mạng thật sang thật giàu…
10.12.08
Một số lỗi xẩy ra với MSSQL
ERROR: MSDTC on server 'servername' is unavailable.
Vào START > SETTINGS > CONTROL PANEL > ADMINISTRATIVE TOOLS > SERVICES. Start service 'Distributed Transaction Coordinator' .
Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.
Trong Management Studio, vào Tools -> Options / chọn Designer Page và bỏ chọn "Prevent saving changes that require table re-creation".
Vào START > SETTINGS > CONTROL PANEL > ADMINISTRATIVE TOOLS > SERVICES. Start service 'Distributed Transaction Coordinator' .
Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.
Trong Management Studio, vào Tools -> Options / chọn Designer Page và bỏ chọn "Prevent saving changes that require table re-creation".
3.12.08
Load cursor from file - using user32.dll
Đảm bảo Cursor màu mè rất đẹp
using System.Runtime.InteropServices;
using System.Reflection;
using System.Windows.Forms;
using System;
namespace myNamespace
{
public class cCursor
{
[DllImport("user32.dll")]
public static extern IntPtr LoadCursorFromFile(string filename);
public static Cursor GetColorCursor(string pathCursor)
{
Cursor mycursor = new Cursor(Cursor.Current.Handle);
//dinosau2.ani is in windows folder??
IntPtr colorcursorhandle = LoadCursorFromFile(pathCursor);
mycursor.GetType().InvokeMember("handle", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, mycursor, new object[] { colorcursorhandle });
return mycursor;
}
}
}
using System.Runtime.InteropServices;
using System.Reflection;
using System.Windows.Forms;
using System;
namespace myNamespace
{
public class cCursor
{
[DllImport("user32.dll")]
public static extern IntPtr LoadCursorFromFile(string filename);
public static Cursor GetColorCursor(string pathCursor)
{
Cursor mycursor = new Cursor(Cursor.Current.Handle);
//dinosau2.ani is in windows folder??
IntPtr colorcursorhandle = LoadCursorFromFile(pathCursor);
mycursor.GetType().InvokeMember("handle", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, mycursor, new object[] { colorcursorhandle });
return mycursor;
}
}
}
17.11.08
Connection String
SQl
Standard security
Trusted Connection
Oracle
1.OLE DB, OleDbConnection (.NET)
Standard security
This connection string uses a provider from Microsoft.
Trusted connection
2.Provider from Oracle.
Standard Security
Trusted Connection
DB2
DB2 .Net Data Provider (IBM.Data.DB2)
Standard
The Server key value syntax is a server name / ip address and an optional port number (note the : in between).
Defining the connection pooling pool size
Disable connection pooling
Connection pooling, time in pool
Defines how many seconds the connection can remain idle in the pool before its removed from the pool.
Connection pooling, do not pool
Specifying schema
All unqualified SQL objects used with the current connection will be qualified with the provide schema name
OLE DB, OleDbConnection (.NET) from Microsoft
TCP/IP
APPC
IBM's OLE DB Provider (shipped with IBM DB2 UDB v7 or above)
TCP/IP
ODBC
Standard
MySQL Connector/ODBC 2.50 (MyODBC 2.50)
Local database
Remote database
Specifying TCP/IP port
The driver defaults to port value 3306, if not specified in the connection string, as 3306 is the default port for MySQL.
MySQL Connector/ODBC 3.51 (MyODBC 3.51)
Local database
Remote database
Specifying TCP/IP port
The driver defaults to port value 3306, if not specified in the connection string, as 3306 is the default port for MySQL.
Specifying character set
OLE DB, OleDbConnection (.NET)
Standard
MySQL Connector/Net (.NET)
Standard
Default port is 3306.
Specifying port
Download the driver at MySQL Developer Zone >>
Named pipes
It is the port value of -1 that tells the driver to use named pipes network protocol. This is available on Windows only. The value is ignored if Unix socket is used.
Multiple servers
Use this to connect to a server in a replicated server configuration without concern on which server to use.
Using encryption
This one activates SSL encryption for all data sent between the client and server. The server needs to have a certificate installed.
This option is available from Connector/NET version 5.0.3. In earlier versions, this option has no effect.
Specifying default command timeout
Use this one to specify a default command timeout for the connection. Please note that the property in the connection string does not supercede the individual command timeout property on an individual command object.
This option is available from Connector/NET version 5.1.4.
Specifying connection attempt timeout
Use this one to specify the length in seconds to wait for a server connection before terminating the attempt and receive an error.
Inactivating prepared statements
Use this one to instruct the provider to ignore any command prepare statements and prevent corruption issues with server side prepared statements.
The option was added in Connector/NET version 5.0.3 and Connector/NET version 1.0.9.
Specifying port
Use this one to specify what port to use for the connection.
The port 3306 is the default MySql port.
The value is ignored if Unix socket is used.
Specifying network protocol
Use this one to specify which network protocol to use for the connection.
"socket" is the default value used if the key isn't specified. Value "tcp" is an equivalent for "socket".
Use "pipe" to use a named pipes connection, "unix" for a Unix socket connection and "memory" to use MySQL shared memory.
Specifying character set
Use this one to specify which character set to use to encode queries sent to the server.
Note that resultsets still are returned in the character set of the data returned.
Specifying shared memory name
Use this one to specify the shared memory object name used for the communication.
This one is applicable only when the connection protocol value is set to "memory".
MySqlConnection (.NET)
eInfoDesigns.dbProvider
SevenObjects MySqlClient (.NET)
Standard
Core Labs MySQLDirect (.NET)
Standard
Read more at Core Lab >>
And on the product page >>
MySQLDriverCS (.NET)
Standard
This is a free simple .NET compliant MySQL driver.
Access
OLE DB, OleDbConnection (.NET)
Standard security
With database password
This is the connection string to use when you have an access database protected with a password using the Set Database Password function in Access.
Workgroup (system database)
Workgroup (system database) specifying username and password
DataDirectory functionality
Access2007
Standard security
With database password
This is the connection string to use when you have an Access 2007 database protected with a password using the "Set Database Password" function in Access.
DataDirectory functionality
Excel
Standard
Standard alternative
Try this one if the one above is not working. Some reports that Excel 2003 need the exta OLEDB; section in the beginning of the string.
Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++ \"
VB6, VBScript ""
xml (web.config etc) "
or maybe use a single quota '.
"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.
"IMEX=1;" tells the driver to always read "intermixed" (numbers, dates, strings etc) data columns as text. Note that this option might affect excel sheet write access negative.
SQL syntax "SELECT * FROM [sheet1$]". I.e. excel worksheet name followed by a "$" and wrapped in "[" "]" brackets.
Check out the [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel] located registry REG_DWORD "TypeGuessRows". That's the key to not letting Excel use only the first 8 rows to guess the columns data type. Set this value to 0 to scan all rows. This might hurt performance.
If the Excel workbook is protected by a password, you cannot open it for data access, even by supplying the correct password with your connection string. If you try, you receive the following error message: "Could not decrypt file."
Standard security
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Trusted Connection
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
Oracle
1.OLE DB, OleDbConnection (.NET)
Standard security
This connection string uses a provider from Microsoft.
Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;
Trusted connection
Provider=msdaora;Data Source=MyOracleDB;Persist Security Info=False;Integrated Security=Yes;
2.Provider from Oracle.
Standard Security
Proovider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;
Trusted Connection
Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;
DB2
DB2 .Net Data Provider (IBM.Data.DB2)
Standard
Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
The Server key value syntax is a server name / ip address and an optional port number (note the : in between).
Defining the connection pooling pool size
Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;Max Pool Size=100;Min Pool Size=10;
Disable connection pooling
Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword; Pooling=false;
Connection pooling, time in pool
Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword; Connection Lifetime=60;
Defines how many seconds the connection can remain idle in the pool before its removed from the pool.
Connection pooling, do not pool
Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword; Connection Reset=false;
Specifying schema
Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword; CurrentSchema=mySchema;
All unqualified SQL objects used with the current connection will be qualified with the provide schema name
OLE DB, OleDbConnection (.NET) from Microsoft
TCP/IP
Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=XXX.XXX.XXX.XXX;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=myUsername;Password=myPassword;
APPC
Provider=DB2OLEDB;APPC Local LU Alias=MyAlias;APPC Remote LU Alias=MyRemote;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=myUsername;Password=myPassword;
IBM's OLE DB Provider (shipped with IBM DB2 UDB v7 or above)
TCP/IP
Provider=IBMDADB2;Database=myDataBase;Hostname=myServerAddress;Protocol=TCPIP; Port=50000;Uid=myUsername;Pwd=myPassword;
ODBC
Standard
Driver={IBM DB2 ODBC DRIVER};Database=myDataBase;Hostname=myServerAddress;Port=1234; Protocol=TCPIP;Uid=myUsername;Pwd=myPassword;MySQL
MySQL Connector/ODBC 2.50 (MyODBC 2.50)
Local database
Driver={mySQL};Server=localhost;Option=16834;Database=myDataBase;
Remote database
Driver={mySQL};Server=myServerAddress;Option=131072;Stmt=;Database=myDataBase; User=myUsername;Password=myPassword;
Specifying TCP/IP port
Driver={mySQL};Server=myServerAddress;Port=3306;Option=131072;Stmt=; Database=myDataBase; User=myUsername;Password=myPassword;
The driver defaults to port value 3306, if not specified in the connection string, as 3306 is the default port for MySQL.
MySQL Connector/ODBC 3.51 (MyODBC 3.51)
Local database
Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;
Remote database
Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
Specifying TCP/IP port
Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Port=3306;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
The driver defaults to port value 3306, if not specified in the connection string, as 3306 is the default port for MySQL.
Specifying character set
Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;charset=UTF8;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
OLE DB, OleDbConnection (.NET)
Standard
Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;
MySQL Connector/Net (.NET)
Standard
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Default port is 3306.
Specifying port
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Download the driver at MySQL Developer Zone >>
Named pipes
Server=myServerAddress;Port=-1;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
It is the port value of -1 that tells the driver to use named pipes network protocol. This is available on Windows only. The value is ignored if Unix socket is used.
Multiple servers
Use this to connect to a server in a replicated server configuration without concern on which server to use.
Server=serverAddress1 & serverAddress2 & etc..;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Using encryption
This one activates SSL encryption for all data sent between the client and server. The server needs to have a certificate installed.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; Encryption=true;
This option is available from Connector/NET version 5.0.3. In earlier versions, this option has no effect.
Specifying default command timeout
Use this one to specify a default command timeout for the connection. Please note that the property in the connection string does not supercede the individual command timeout property on an individual command object.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;default command timeout=20;
This option is available from Connector/NET version 5.1.4.
Specifying connection attempt timeout
Use this one to specify the length in seconds to wait for a server connection before terminating the attempt and receive an error.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Connection Timeout=5;
Inactivating prepared statements
Use this one to instruct the provider to ignore any command prepare statements and prevent corruption issues with server side prepared statements.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Ignore Prepare=true;
The option was added in Connector/NET version 5.0.3 and Connector/NET version 1.0.9.
Specifying port
Use this one to specify what port to use for the connection.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Port=3306;
The port 3306 is the default MySql port.
The value is ignored if Unix socket is used.
Specifying network protocol
Use this one to specify which network protocol to use for the connection.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; Protocol=socket;
"socket" is the default value used if the key isn't specified. Value "tcp" is an equivalent for "socket".
Use "pipe" to use a named pipes connection, "unix" for a Unix socket connection and "memory" to use MySQL shared memory.
Specifying character set
Use this one to specify which character set to use to encode queries sent to the server.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; CharSet=UTF8;
Note that resultsets still are returned in the character set of the data returned.
Specifying shared memory name
Use this one to specify the shared memory object name used for the communication.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Shared Memory Name=MYSQL;
This one is applicable only when the connection protocol value is set to "memory".
MySqlConnection (.NET)
eInfoDesigns.dbProvider
Data Source=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Command Logging=false;
SevenObjects MySqlClient (.NET)
Standard
Host=myServerAddress;UserName=myUsername;Password=myPassword;Database=myDataBase;
Core Labs MySQLDirect (.NET)
Standard
User ID=root;Password=myPassword;Host=localhost;Port=3306;Database=myDataBase; Direct=true;Protocol=TCP;Compress=false;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;
Read more at Core Lab >>
And on the product page >>
MySQLDriverCS (.NET)
Standard
Location=myServerAddress;Data Source=myDataBase;User ID=myUsername;Password=myPassword;Port=3306;Extended Properties="""";
This is a free simple .NET compliant MySQL driver.
Access
OLE DB, OleDbConnection (.NET)
Standard security
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;
With database password
This is the connection string to use when you have an access database protected with a password using the Set Database Password function in Access.
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:Database Password=MyDbPassword;
Workgroup (system database)
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:System Database=system.mdw;
Workgroup (system database) specifying username and password
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:System Database=system.mdw;User ID=myUsername;Password=myPassword;
DataDirectory functionality
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\myDatabase.mdb;User Id=admin;Password=;
Access2007
Standard security
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;
With database password
This is the connection string to use when you have an Access 2007 database protected with a password using the "Set Database Password" function in Access.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Jet OLEDB:Database Password=MyDbPassword;
DataDirectory functionality
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\myAccess2007file.accdb;Persist Security Info=False;
Excel
Standard
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";
Standard alternative
Try this one if the one above is not working. Some reports that Excel 2003 need the exta OLEDB; section in the beginning of the string.
OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";
Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++ \"
VB6, VBScript ""
xml (web.config etc) "
or maybe use a single quota '.
"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.
"IMEX=1;" tells the driver to always read "intermixed" (numbers, dates, strings etc) data columns as text. Note that this option might affect excel sheet write access negative.
SQL syntax "SELECT * FROM [sheet1$]". I.e. excel worksheet name followed by a "$" and wrapped in "[" "]" brackets.
Check out the [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel] located registry REG_DWORD "TypeGuessRows". That's the key to not letting Excel use only the first 8 rows to guess the columns data type. Set this value to 0 to scan all rows. This might hurt performance.
If the Excel workbook is protected by a password, you cannot open it for data access, even by supplying the correct password with your connection string. If you try, you receive the following error message: "Could not decrypt file."
29.10.08
Vô đề
Con chim nhỏ chiều nay không dám hót
Sợ áng mây giật mình trôi về phía trời xa
Những nốt nhạc trào dâng nơi cổ họng
Man mác buồn và say đắm thiết tha
Sợ áng mây giật mình trôi về phía trời xa
Những nốt nhạc trào dâng nơi cổ họng
Man mác buồn và say đắm thiết tha