Programming Microsoft SQL Server 2000 with Microsoft Visual Basic .Net - P7
Số trang: 50
Loại file: pdf
Dung lượng: 0.00 B
Lượt xem: 8
Lượt tải: 0
Xem trước 5 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tham khảo tài liệu programming microsoft sql server 2000 with microsoft visual basic .net - p7, công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic .Net - P7 labels v isible by passing t he argum ent True t o ShowLabelsBox es. As a result , a user can ent er a SQL Serv er login and password so t hat t he form can at t em pt t o m ake a connect ion based on a SQL Serv er inst ead of a Windows login. Finally, by click ing t he Windows NT radio but t on, t he user inv ok es t he RadioBut t on1_CheckedChanged ev ent pr ocedure. This procedure m ak es t he cont r ols for SQL Server login credent ials invisible if t hey ar e show ing. When t he user clicks t his RadioBut t on1, it indicat es he or she want s t o m ak e a connect ion wit h a Windows login. Ther efore, Form 3 doesn’t need t o show t he cont r ols for a SQL Ser ver login. Private Sub Form3_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ’Set RadioButton1 to Checked for connection via ’Windows NT login. RadioButton1.Checked = True ’Hide login and password controls because they ’aren’t necessary with Windows NT login. ShowLabelsBoxes(False) End Sub Private Sub RadioButton1_CheckedChanged _ (ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles RadioButton1.CheckedChanged ’Hide login and password controls because they ’aren’t necessary with Windows NT login. ShowLabelsBoxes(False) End Sub Private Sub RadioButton2_CheckedChanged _ (ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles RadioButton2.CheckedChanged ’Show login and password controls because they ’are necessary for a SQL Server login. ShowLabelsBoxes(True) End Sub Sub ShowLabelsBoxes(ByVal bolShowEm As Boolean) ’Set the visibility of the second and third text ’boxes and their labels according to the value ’of bolShowEm. Label2.Visible = bolShowEm TextBox2.Visible = bolShowEm Label3.Visible = bolShowEm TextBox3.Visible = bolShowEm End Sub The follow ing excerpt fr om t he Form 3 m odule shows t he code devot ed t o m ak ing t he connect ion based on t he radio but t on select ion and t ext box ent r ies. The excerpt st art s wit h a m odule- lev el declarat ion of t he cnn1 obj ect refer ence as a SqlConnect ion obj ect . A m odule- level declarat ion isn’t st rict ly necessary in t hePlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark. cont ext of t his sam ple, but t his t ype of declarat ion m ak es t he SqlConnect ion obj ect available t o ot her procedures t hat could use it . I n any ev ent , not ice t hat t he declarat ion specifies t he full nam e for t he nam espace cont aining t he SqlConnect ion obj ect r eference. This is because t he m odule doesn’t include an I m port s st at em ent for t he Syst em .Dat a.SqlClient nam espace. By not using t he I m port s st at em ent at t he t op of t he Form 3 m odule, t he Cat ch clause in t he excerpt m ust reference a Syst em except ion inst ead of t he m ore specific SqlClient except ion. I n spit e of t his dev iat ion from t he sam ple in t he “Cat ching SqlConnect ion Except ions” sect ion, SqlClient ex cept ions st ill percolat e up t hr ough t he m ore general Syst em except ion specificat ion. Aside from t he declarat ion issues for cnn1, t he balance of t he code excerpt is a st raight forward m ixt ur e of t he code sam ples developed prev iously in t his chapt er. Based on w het her RadioBut t on1 is checked, t he But t on1_Click ev ent procedure com poses a connect ion st ring for eit her a Windows or a SQL Serv er login. Then t he procedure inst ant iat es a connect ion based on t he connect ion st r ing. Wit hin a Try…Cat ch…Finally st at em ent , t he proce ...
Nội dung trích xuất từ tài liệu:
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic .Net - P7 labels v isible by passing t he argum ent True t o ShowLabelsBox es. As a result , a user can ent er a SQL Serv er login and password so t hat t he form can at t em pt t o m ake a connect ion based on a SQL Serv er inst ead of a Windows login. Finally, by click ing t he Windows NT radio but t on, t he user inv ok es t he RadioBut t on1_CheckedChanged ev ent pr ocedure. This procedure m ak es t he cont r ols for SQL Server login credent ials invisible if t hey ar e show ing. When t he user clicks t his RadioBut t on1, it indicat es he or she want s t o m ak e a connect ion wit h a Windows login. Ther efore, Form 3 doesn’t need t o show t he cont r ols for a SQL Ser ver login. Private Sub Form3_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ’Set RadioButton1 to Checked for connection via ’Windows NT login. RadioButton1.Checked = True ’Hide login and password controls because they ’aren’t necessary with Windows NT login. ShowLabelsBoxes(False) End Sub Private Sub RadioButton1_CheckedChanged _ (ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles RadioButton1.CheckedChanged ’Hide login and password controls because they ’aren’t necessary with Windows NT login. ShowLabelsBoxes(False) End Sub Private Sub RadioButton2_CheckedChanged _ (ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles RadioButton2.CheckedChanged ’Show login and password controls because they ’are necessary for a SQL Server login. ShowLabelsBoxes(True) End Sub Sub ShowLabelsBoxes(ByVal bolShowEm As Boolean) ’Set the visibility of the second and third text ’boxes and their labels according to the value ’of bolShowEm. Label2.Visible = bolShowEm TextBox2.Visible = bolShowEm Label3.Visible = bolShowEm TextBox3.Visible = bolShowEm End Sub The follow ing excerpt fr om t he Form 3 m odule shows t he code devot ed t o m ak ing t he connect ion based on t he radio but t on select ion and t ext box ent r ies. The excerpt st art s wit h a m odule- lev el declarat ion of t he cnn1 obj ect refer ence as a SqlConnect ion obj ect . A m odule- level declarat ion isn’t st rict ly necessary in t hePlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark. cont ext of t his sam ple, but t his t ype of declarat ion m ak es t he SqlConnect ion obj ect available t o ot her procedures t hat could use it . I n any ev ent , not ice t hat t he declarat ion specifies t he full nam e for t he nam espace cont aining t he SqlConnect ion obj ect r eference. This is because t he m odule doesn’t include an I m port s st at em ent for t he Syst em .Dat a.SqlClient nam espace. By not using t he I m port s st at em ent at t he t op of t he Form 3 m odule, t he Cat ch clause in t he excerpt m ust reference a Syst em except ion inst ead of t he m ore specific SqlClient except ion. I n spit e of t his dev iat ion from t he sam ple in t he “Cat ching SqlConnect ion Except ions” sect ion, SqlClient ex cept ions st ill percolat e up t hr ough t he m ore general Syst em except ion specificat ion. Aside from t he declarat ion issues for cnn1, t he balance of t he code excerpt is a st raight forward m ixt ur e of t he code sam ples developed prev iously in t his chapt er. Based on w het her RadioBut t on1 is checked, t he But t on1_Click ev ent procedure com poses a connect ion st ring for eit her a Windows or a SQL Serv er login. Then t he procedure inst ant iat es a connect ion based on t he connect ion st r ing. Wit hin a Try…Cat ch…Finally st at em ent , t he proce ...
Tìm kiếm theo từ khóa liên quan:
thủ thuật máy tính công nghệ thông tin tin học quản trị mạng computer networkTài liệu liên quan:
-
52 trang 433 1 0
-
24 trang 359 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 320 0 0 -
Làm việc với Read Only Domain Controllers
20 trang 310 0 0 -
74 trang 303 0 0
-
96 trang 298 0 0
-
Báo cáo thực tập thực tế: Nghiên cứu và xây dựng website bằng Wordpress
24 trang 291 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng di động android quản lý khách hàng cắt tóc
81 trang 286 0 0 -
EBay - Internet và câu chuyện thần kỳ: Phần 1
143 trang 277 0 0 -
Tài liệu hướng dẫn sử dụng thư điện tử tài nguyên và môi trường
72 trang 270 0 0