欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

vb.netUI庫,vbnet ide

vb.net的數(shù)據(jù)庫連接

1·綁定數(shù)據(jù)源來進(jìn)行連接

創(chuàng)新互聯(lián)公司是創(chuàng)新、創(chuàng)意、研發(fā)型一體的綜合型網(wǎng)站建設(shè)公司,自成立以來公司不斷探索創(chuàng)新,始終堅持為客戶提供滿意周到的服務(wù),在本地打下了良好的口碑,在過去的十載時間我們累計服務(wù)了上千家以及全國政企客戶,如格柵板等企業(yè)單位,完善的項目管理流程,嚴(yán)格把控項目進(jìn)度與質(zhì)量監(jiān)控加上過硬的技術(shù)實力獲得客戶的一致稱揚(yáng)。

2.用代碼連接

先到數(shù)據(jù)庫建立一個數(shù)據(jù)庫和相應(yīng)的表

連接數(shù)據(jù)庫的代碼:

Dim str As String = "Data Source=服務(wù)器名;Initial Catalog=數(shù)據(jù)庫名;Persist Security Info=True;User ID=;Password="

dim conn As SqlClient.SqlConnection

try

conn = New SqlClient.SqlConnection

conn.ConnectionString = str

conn.Open()

Return True

Catch ex As Exception

MsgBox(ex.ToString)

Return False

End Try

登錄代碼:Dim str As String = "Data Source=服務(wù)器名;Initial Catalog=數(shù)據(jù)庫名;Persist Security Info=True;User ID=;Password="

dim conn As SqlClient.SqlConnection

conn = New SqlClient.SqlConnection

conn.ConnectionString = str

conn.Open()

sqlstr = "Select * From Amd Where AmdName='" TextBox1.Text "' And AmdPwd = '" TextBox2.Text "'"

Dim sqlcmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlstr, conn)

Dim dr As SqlClient.SqlDataReader

dr = sqlcmd.ExecuteReader

If dr.Read = True Then '判斷一條記錄為真

kf.Show() '顯示下個窗體

Me.Hide() ’隱藏當(dāng)前窗體

Else

MessageBox.Show("輸入信息有誤!", "提示")

TextBox1.Text = ""

TextBox2.Text = ""

End If

VB.NET備份SQL數(shù)據(jù)庫

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.IO;

using System.Text;

using _5dRss.Const;

using _5dRss.lib.Data.Tool;

public partial class admin_admin_dbmanage : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

//生成備份文件列表

ListBackupFiles();

if (!Page.IsPostBack)

{

Showmsg.Visible = false;

//數(shù)據(jù)庫路徑

lilDBPath.Text = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];

//新建一個 FileInfo 對象,并獲得數(shù)據(jù)庫文件的大小,然后轉(zhuǎn)換單位為KB

FileInfo myFileInfo = new FileInfo(lilDBPath.Text);

lilDBSize.Text = Convert.ToString(myFileInfo.Length/1024) + " KB";

//如果兩個參數(shù)都不為空,則繼續(xù)執(zhí)行

if (Request.QueryString["cmd"] != null Request.QueryString["source"] != null)

{

//備份數(shù)據(jù)庫原文件名

string sourceFileName = Request.QueryString["source"];

//如果 cmd 參數(shù)為 DelFile

if (Request.QueryString["cmd"].Equals("DelFile"))

{

//刪除備份數(shù)據(jù)庫文件

File.Delete(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + sourceFileName);

//刷新備份文件列表

ListBackupFiles();

Showmsg.Visible = true;

Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'刪除備份數(shù)據(jù)庫成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";

}

//如果 cmd 參數(shù)為 Restore

if (Request.QueryString["cmd"].Equals("Restore"))

{

//用備份文件覆蓋原文件

File.Copy(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + sourceFileName, HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"], true);

//刷新備份文件列表

ListBackupFiles();

Showmsg.Visible = true;

Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'還原備份數(shù)據(jù)庫成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";

}

}

}

}

protected void lnkbtnCompactDB_Click(object sender, EventArgs e)

{

//壓縮修復(fù)數(shù)據(jù)庫

AccessDBtool.CompactAccessDB(SysConfig.ConnectionString, HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"]);

Showmsg.Visible = true;

Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'壓縮修復(fù)數(shù)據(jù)庫成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";

}

protected void lnkbtnBackupDB_Click(object sender, EventArgs e)

{

string sourceFileName = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];

string destFileName = HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + "Backup_";

destFileName += DateTime.Now.ToString("yyyyMMddHHmmss");

destFileName += ".mbk";

//將數(shù)據(jù)庫文件Copy到Backup目錄,如果有重名文件就覆蓋原文件

File.Copy(sourceFileName, destFileName, true);

//生成備份文件列表

ListBackupFiles();

Showmsg.Visible = true;

Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'備份數(shù)據(jù)庫成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";

}

/// summary

/// 生成備份文件列表

/// /summary

/// returns文件列表,文件詳細(xì)信息及操作選項的HTML代碼/returns

public void ListBackupFiles()

{

//如果目錄不存在則創(chuàng)建次目錄

if (!Directory.Exists(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\"))

Directory.CreateDirectory(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\");

DirectoryInfo mydir = new DirectoryInfo(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\");

StringBuilder sb = new StringBuilder();

foreach (FileInfo f in mydir.GetFiles())

{

sb.Append("a href='backup/" + f.Name + "' target='_blank'img border='0' src='images/mdb.gif' style='margin:4px 3px -3px 0px'/" + f.Name + "/a a href='?cmd=DelFilesource=" + f.Name + "' title='刪除備份文件'刪除/a | a href='?cmd=Restoresource=" + f.Name + "' title='刪除備份文件'還原數(shù)據(jù)庫/a | " + f.Length/1024 + " KB | " + f.CreationTime + "br /");

}

lilBackupFileList.Text = sb.ToString();

}

}

把下面這句換成你的數(shù)據(jù)庫地址:

//數(shù)據(jù)庫路徑

// lilDBPath.Text = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];

VB.net一個很簡單的UI問題

花了二十分鐘給你寫了代碼,已測試。建議學(xué)習(xí)并使用System.Drawing繪制。

主要是掌握Graphics.FillRectangle和DrawString的使用。

Imports?System.Drawing

Public?Class?進(jìn)度條UI

Public?上面筆刷?As?SolidBrush?=?New?SolidBrush(Color.FromArgb(192,?175,?238,?238))

Public?下面筆刷?As?SolidBrush?=?New?SolidBrush(Color.FromArgb(192,?30,?144,?255))

Public?文字筆?As?SolidBrush?=?New?SolidBrush(Color.FromArgb(255,?255,?255,?255))

Public?字體?As?Font?=?New?Font("微軟雅黑",?14.0)

Public?文字格式?As?StringFormat?=?New?StringFormat()?With

{.Alignment?=?StringAlignment.Center,?.LineAlignment?=?StringAlignment.Center}

'''?summary

'''?繪制指定進(jìn)度的圖像。

'''?當(dāng)進(jìn)度變化時調(diào)用一次本方法,建議將創(chuàng)建的Graphics對象保存到變量而不要重復(fù)創(chuàng)建。。

'''?/summary

'''?param?name="控件"繪制到此控件的工作區(qū)/param

'''?param?name="g"繪制到控件的Graphics對象,例如?Button1.CreateGraphics()/param

'''?param?name="進(jìn)度"進(jìn)度百分比實數(shù),57%?=?0.57/param

Public?Sub?繪制(ByRef?控件?As?Control,?ByRef?g?As?Graphics,?ByVal?進(jìn)度?As?Double)

Dim?矩形?=?控件.ClientRectangle?'獲取控件的工作區(qū)矩形

Dim?下面高度?=?CInt(矩形.Height?*?進(jìn)度)?'獲取下面顏色塊的高度

Dim?中間位置?=?矩形.Top?+?矩形.Height?-?下面高度?'獲取中間分界線的Y坐標(biāo)

Dim?上矩形?=?New?Rectangle(矩形.X,?矩形.Y,?矩形.Width,?矩形.Height?-?下面高度)

Dim?下矩形?=?New?Rectangle(矩形.X,?中間位置,?矩形.Width,?下面高度)

g.FillRectangle(上面筆刷,?上矩形)

g.FillRectangle(下面筆刷,?下矩形)

'繪制文字

Dim?文字?As?String?=?String.Format("{0:0.00}%",?進(jìn)度?*?100)

g.DrawString(文字,?字體,?文字筆,?矩形,?文字格式)

End?Sub

End?Class

下面是Form1窗體的代碼:添加一個Button1和Timer1控件,將Button1尺寸拖大點

Public?Class?Form1

Public?g?As?Graphics

Public?進(jìn)度條UI?As?New?進(jìn)度條UI

Public?進(jìn)度?As?Double

Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click

g?=?Button1.CreateGraphics()

Timer1.Enabled?=?Not?Timer1.Enabled

End?Sub

Private?Sub?Timer1_Tick(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Timer1.Tick

進(jìn)度?+=?0.01

進(jìn)度條UI.繪制(Button1,?g,?進(jìn)度)

End?Sub

End?Class

用VB.NET開發(fā)的應(yīng)用程序,大家用什么軟件或第三方控件做UI界面的編碼啊?

Visual Studio?2013

Microsoft Visual Studio(簡稱VS)是美國微軟公司的開發(fā)工具包系列產(chǎn)品。VS是一個基本完整的開發(fā)工具集,它包括了整個軟件生命周期中所需要的大部分工具,如UML工具、代碼管控工具、集成開發(fā)環(huán)境(IDE)等等。所寫的目標(biāo)代碼適用于微軟支持的所有平臺,包括Microsoft Windows、Windows Mobile、Windows CE、.NET Framework、.NET Compact Framework和Microsoft?Silverlight?及Windows Phone。?Visual Studio是目前最流行的Windows平臺應(yīng)用程序的集成開發(fā)環(huán)境。最新版本為 Visual Studio 2013 版本,基于.NET Framework?4.5.1 。

vb.net 怎么操作數(shù)據(jù)庫

如果樓主熟悉VB6,可以直接在項目中添加ADODB的Com引用,這樣你就可以像VB6那樣操作數(shù)據(jù)庫了!

另外

.NET

Framework中連接數(shù)據(jù)庫要用到ADO.NET。如果要操作Access數(shù)據(jù)庫,要用到System.Data.OleDb命名空間下的許多類。

比如按樓主所說,“我想在textbox1中顯示表一中【一些數(shù)據(jù)】字段下的第一個內(nèi)容”:

'首先導(dǎo)入命名空間

Imports

System.Data

Imports

System.Data.OleDb

'然后在某一個事件處理程序中寫:

Dim

conn

As

New

OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data

Source=數(shù)據(jù)庫.accdb;Jet

OLEDB:Database

Password=MyDbPassword")

Dim

command

As

New

OleDbCommand("Select

*

From

數(shù)據(jù)表",

conn)

conn.Open()

'打開數(shù)據(jù)庫連接

Dim

reader

As

OleDbDataReader

=

command.ExecuteReader()

'執(zhí)行SQL語句,返回OleDbDataReader

對象

Do

While

reader.Read()

'讀取一條數(shù)據(jù)

textbox1.Text

+=

reader("一些數(shù)據(jù)")

VbCrLf

Loop

reader.Close()

'關(guān)閉OleDbDataReader

conn.Close()

'關(guān)閉連接

當(dāng)前名稱:vb.netUI庫,vbnet ide
本文路徑:http://chinadenli.net/article38/dsgissp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)虛擬主機(jī)自適應(yīng)網(wǎng)站企業(yè)網(wǎng)站制作移動網(wǎng)站建設(shè)商城網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名