資源簡介
Accp5.0 s1 項目實戰(zhàn) MyQQ 源代碼和數(shù)據(jù)庫

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Data.SqlClient;
namespace?MyQQ
{
????///?
????///?聊天窗體
????///?
????public?partial?class?ChatForm?:?Form
????{
????????public?int?friendId;?????//?當前聊天的好友號碼
????????public?string?nickName;??//?當前聊天的好友昵稱
????????public?int?faceId;???????//?當前聊天的好友頭像Id????????
????????public?ChatForm()
????????{
????????????InitializeComponent();
????????}
????????//?窗體加載時的動作
????????private?void?ChatForm_Load(object?sender?EventArgs?e)
????????{
????????????//?設置窗體標題
????????????this.Text?=?string.Format(“與{0}聊天中“nickName);
????????????//?設置窗體頂部顯示的好友信息
????????????picFace.Image?=?ilFaces.Images[faceId];
????????????lblFriend.Text?=?string.Format(“{0}({1})“nickNamefriendId);
????????????//?讀取所有的未讀消息,顯示在窗體中
????????????ShowMessage();
????????}
????????//?關閉窗體
????????private?void?btnClose_Click(object?sender?EventArgs?e)
????????{
????????????this.Close();
????????}
????????//?發(fā)送消息
????????private?void?btnSend_Click(object?sender?EventArgs?e)
????????{
????????????if?(txtChat.Text.Trim()?==?““)?//?不能發(fā)送空消息
????????????{
????????????????MessageBox.Show(“不能發(fā)送空消息!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????????return;
????????????}
????????????else?if?(txtChat.Text.Trim().Length?>?50)
????????????{
????????????????MessageBox.Show(“消息內容過長,請分為幾條發(fā)送!“?“提示“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????????return;
????????????}
????????????else??//?發(fā)送消息,寫入數(shù)據(jù)庫
????????????{
????????????????//?MessageTypeId:1-表示聊天消息,為簡化操作沒有讀取數(shù)據(jù)表,到S2可以用常量或者枚舉實現(xiàn)
????????????????//?MessageState:0-表示消息狀態(tài)是未讀
????????????????int?result?=?-1;?//?表示操作數(shù)據(jù)庫的結果
????????????????string?sql?=?string.Format(
????????????????????“INSERT?INTO?Messages?(FromUserId?ToUserId?Message?MessageTypeId?MessageState)?VALUES?({0}{1}‘{2}‘{3}{4})“
????????????????????UserHelper.loginId?friendId?txtChat.Text.Trim()?1?0);
????????????????try
????????????????{
????????????????????//?執(zhí)行命令
????????????????????SqlCommand?command?=?new?SqlCommand(sql?DBHelper.connection);
????????????????????DBHelper.connection.Open();
????????????????????result?=?command.ExecuteNonQuery();
????????????????}
????????????????catch?(Exception?ex)
????????????????{
????????????????????Console.WriteLine(ex.Message);
????????????????}
????????????????finally
????????????????{
????????????????????DBHelper.connection.Close();
????????????????}
????????????????if?(result?!=?1)
????????????????{
????????????????????MessageBox.Show(“服務器出現(xiàn)意外錯誤!“?“抱歉“?MessageBoxButtons.OK?MessageBoxIcon.Error);
????????????????}
????????????????txtChat.Text?=?““;??//?輸入消息清空
????????????????this.Close();
????????????}
????????}
????????///?
????????///?讀取所有的未讀消息,顯示在窗體中
????????///?
????????private
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????901??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ.sln
?????文件??????65024??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ.suo
?????文件???????6297??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\ChatForm.cs
?????文件??????13743??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\ChatForm.Designer.cs
?????文件????1503146??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\ChatForm.resx
?????文件????????384??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\DBHelper.cs
?????文件???????1863??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\FacesForm.cs
?????文件??????11006??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\FacesForm.Designer.cs
?????文件????1415047??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\FacesForm.resx
?????文件???????3817??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\LoginForm.cs
?????文件???????9976??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\LoginForm.Designer.cs
?????文件??????76726??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\LoginForm.resx
?????文件??????18798??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\MainForm.cs
?????文件??????21834??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\MainForm.Designer.cs
?????文件????1853034??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\MainForm.resx
?????文件???????6172??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\MyQQ.csproj
?????文件???????1150??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\MyQQ.ico
?????文件??????13272??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\PersonalInfoForm.cs
?????文件??????38745??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\PersonalInfoForm.Designer.cs
?????文件????1600920??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\PersonalInfoForm.resx
?????文件????????467??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\Program.cs
?????文件??????10463??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\RegisterForm.cs
?????文件??????17054??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\RegisterForm.Designer.cs
?????文件?????123334??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\RegisterForm.resx
?????文件???????4184??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\RequestForm.cs
?????文件??????12140??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\RequestForm.Designer.cs
?????文件????1457628??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\RequestForm.resx
?????文件??????14398??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\SearchFriendForm.cs
?????文件??????36601??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\SearchFriendForm.Designer.cs
?????文件?????142904??2008-09-09?17:37??MyQQ\項目參考代碼\MyQQ\MyQQ\SearchFriendForm.resx
............此處省略45個文件信息
- 上一篇:Apache 2.2.34 32位 最終版
- 下一篇:kml中移動模型位置
評論
共有 條評論