C# xecuteReader(); Talent_Name.Items.Clear(); while(myReader.Read()) { string\u description=myReader.GetString(“description”); 人才描述。Text=人才描述; } } 捕获(例外情况除外) { MessageBox.Show(“错误:\r\n”+ex); } } 私有无效技能\u名称\u下拉打开(对象发送者,事件参数e) { string constring=“datasource=localhost;port=3306;username=root;password=MyPass;”; string Query=“从黑暗异端中选择技能名称。学习技能,其中字符名称=”+cb\U字符名称。文本+”;”; MySqlConnection conDataBase=新的MySqlConnection(constring); MySqlCommand cmdDatabase=新的MySqlCommand(查询、条件数据库); MySqlDataReader; 尝试 { conDataBase.Open(); myReader=cmdDatabase.ExecuteReader(); while(myReader.Read()) { string skill_name=myReader.GetString(“skill_name”); 技能名称。项目。添加(技能名称); } } 捕获(例外情况除外) { MessageBox.Show(“错误:\r\n”+ex); } } 私有无效技能\u名称\u下拉关闭(对象发送者,事件参数e) { string constring=“datasource=localhost;port=3306;username=root;password=MyPass;”; string Query=“选择Learn_skills.Skill_Name,skills.Descriptor FROM dark_heresy.Learn_skills,dark_heresy.Skill其中Learn_skills.SkillName=SkillName和Learn_skills.Character_Name=”+cb_CharacterName.Text+“;”; MySqlConnection conDataBase=新的MySqlConnection(constring); MySqlCommand cmdDataBase=新的MySqlCommand(查询、条件数据库); MySqlDataReader; 尝试 { conDataBase.Open(); myReader=cmdDataBase.ExecuteReader(); Skill_Name.Items.Clear(); while(myReader.Read()) { string skills_description=myReader.GetString(“描述符”); Skill\u Description.Text=skills\u Description; } } 捕获(例外情况除外) { MessageBox.Show(“错误:\r\n”+ex); } } } }

C# xecuteReader(); Talent_Name.Items.Clear(); while(myReader.Read()) { string\u description=myReader.GetString(“description”); 人才描述。Text=人才描述; } } 捕获(例外情况除外) { MessageBox.Show(“错误:\r\n”+ex); } } 私有无效技能\u名称\u下拉打开(对象发送者,事件参数e) { string constring=“datasource=localhost;port=3306;username=root;password=MyPass;”; string Query=“从黑暗异端中选择技能名称。学习技能,其中字符名称=”+cb\U字符名称。文本+”;”; MySqlConnection conDataBase=新的MySqlConnection(constring); MySqlCommand cmdDatabase=新的MySqlCommand(查询、条件数据库); MySqlDataReader; 尝试 { conDataBase.Open(); myReader=cmdDatabase.ExecuteReader(); while(myReader.Read()) { string skill_name=myReader.GetString(“skill_name”); 技能名称。项目。添加(技能名称); } } 捕获(例外情况除外) { MessageBox.Show(“错误:\r\n”+ex); } } 私有无效技能\u名称\u下拉关闭(对象发送者,事件参数e) { string constring=“datasource=localhost;port=3306;username=root;password=MyPass;”; string Query=“选择Learn_skills.Skill_Name,skills.Descriptor FROM dark_heresy.Learn_skills,dark_heresy.Skill其中Learn_skills.SkillName=SkillName和Learn_skills.Character_Name=”+cb_CharacterName.Text+“;”; MySqlConnection conDataBase=新的MySqlConnection(constring); MySqlCommand cmdDataBase=新的MySqlCommand(查询、条件数据库); MySqlDataReader; 尝试 { conDataBase.Open(); myReader=cmdDataBase.ExecuteReader(); Skill_Name.Items.Clear(); while(myReader.Read()) { string skills_description=myReader.GetString(“描述符”); Skill\u Description.Text=skills\u Description; } } 捕获(例外情况除外) { MessageBox.Show(“错误:\r\n”+ex); } } } },c#,mysql,wpf,mvvm,C#,Mysql,Wpf,Mvvm,一种叫做人才的形式: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using Syste

一种叫做人才的形式:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MySql.Data.MySqlClient;

namespace Dark_Heresy
{
    /// <summary>
    /// Interaction logic for Talents.xaml
    /// </summary>
    public partial class Talents : Window
    {
        public Talents()
        {
            InitializeComponent();
        }

        private void cb_loader(object sender, RoutedEventArgs e)
        {
            string constring = "datasource= localhost; port=3306; username=root; password=MyPass;";
            string Query = "SELECT TalentName FROM dark_heresy.talents";
            MySqlConnection conDataBase = new MySqlConnection(constring);
            MySqlCommand cmdDatabase = new MySqlCommand(Query, conDataBase);
            MySqlDataReader myReader;

            try
            {
                conDataBase.Open();
                myReader = cmdDatabase.ExecuteReader();

                while (myReader.Read())
                {
                    string talentname = myReader.GetString("TalentName");
                    cb_Talents.Items.Add(talentname);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error: \r\n" + ex);
            }

        }

        private void cb_Talent_DropDownClosed_(object sender, EventArgs e)
        {
            string constring = "datasource = localhost; port = 3306; username = root; password = MyPass;";
            string Query = "SELECT * FROM dark_heresy.talents WHERE TalentName='" + cb_Talents.Text + "' ;";
            MySqlConnection conDataBase = new MySqlConnection(constring);
            MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
            MySqlDataReader myReader;

            try
            {
                conDataBase.Open();
                myReader = cmdDataBase.ExecuteReader();

                while (myReader.Read())
                {

                    string description = myReader.GetString("Description");
                    string strength = myReader.GetInt32("R_Str").ToString();
                    string weaponskill = myReader.GetInt32("R_WS").ToString();
                    string ballisticskill = myReader.GetInt32("R_BS").ToString();
                    string fellowship = myReader.GetInt32("R_Fel").ToString();
                    string perception = myReader.GetInt32("R_Per").ToString();
                    string intelligence = myReader.GetInt32("R_Int").ToString();
                    string agility = myReader.GetInt32("R_Agi").ToString();
                    string willpower = myReader.GetInt32("R_WP").ToString();
                    string toughness = myReader.GetInt32("R_Tough").ToString();


                    TextDescription.Text = description;
                    TextStrength.Text = strength;
                    TextWeaponskill.Text = weaponskill;
                    TextBallisticskill.Text = ballisticskill;
                    TextFellowship.Text = fellowship;
                    TextPerception.Text = perception;
                    TextIntelligence.Text = intelligence;
                    TextAgility.Text = agility;
                    TextWillpower.Text = willpower;
                    TextToughness.Text = toughness;



                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error: \r\n" + ex);
            }
        }
    }
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
使用System.Windows;
使用System.Windows.Controls;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;
使用System.Windows.Shapes;
使用MySql.Data.MySqlClient;
异端
{
/// 
///人才交互逻辑.xaml
/// 
公共部分类人才:窗口
{
公共人才()
{
初始化组件();
}
私有void cb_加载器(对象发送器,RoutedEventArgs e)
{
string constring=“datasource=localhost;port=3306;username=root;password=MyPass;”;
string Query=“从黑暗中选择天资”\u heresy.talents”;
MySqlConnection conDataBase=新的MySqlConnection(constring);
MySqlCommand cmdDatabase=新的MySqlCommand(查询、条件数据库);
MySqlDataReader;
尝试
{
conDataBase.Open();
myReader=cmdDatabase.ExecuteReader();
while(myReader.Read())
{
string talentname=myReader.GetString(“talentname”);
cb_人才。项目。添加(人才名称);
}
}
捕获(例外情况除外)
{
MessageBox.Show(“错误:\r\n”+ex);
}
}
私有无效cb\u人才\u下拉关闭\u(对象发送者,事件参数)
{
string constring=“datasource=localhost;port=3306;username=root;password=MyPass;”;
string Query=“SELECT*FROM dark_heresy.tallents,其中TalentName=”+cb_tallents.Text+“;”;
MySqlConnection conDataBase=新的MySqlConnection(constring);
MySqlCommand cmdDataBase=新的MySqlCommand(查询、条件数据库);
MySqlDataReader;
尝试
{
conDataBase.Open();
myReader=cmdDataBase.ExecuteReader();
while(myReader.Read())
{
string description=myReader.GetString(“description”);
字符串强度=myReader.GetInt32(“R_Str”).ToString();
string weaponskill=myReader.GetInt32(“R_WS”).ToString();
string bollisticskill=myReader.GetInt32(“R_BS”).ToString();
string=myReader.GetInt32(“R_Fel”).ToString();
string perception=myReader.GetInt32(“R_Per”).ToString();
string intelligence=myReader.GetInt32(“R_Int”).ToString();
字符串agility=myReader.GetInt32(“R_Agi”).ToString();
字符串willpower=myReader.GetInt32(“R_WP”).ToString();
字符串韧性=myReader.GetInt32(“R_Tough”).ToString();
Text描述。Text=描述;
文本强度。文本=强度;
Text武器技能。Text=武器技能;
Text弹道技能。Text=弹道技能;
Text团契。Text=团契;
文本感知。文本=感知;
Text智能。Text=智能;
Text=agility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MySql.Data.MySqlClient;

namespace Dark_Heresy
{
    /// <summary>
    /// Interaction logic for Talents.xaml
    /// </summary>
    public partial class Talents : Window
    {
        public Talents()
        {
            InitializeComponent();
        }

        private void cb_loader(object sender, RoutedEventArgs e)
        {
            string constring = "datasource= localhost; port=3306; username=root; password=MyPass;";
            string Query = "SELECT TalentName FROM dark_heresy.talents";
            MySqlConnection conDataBase = new MySqlConnection(constring);
            MySqlCommand cmdDatabase = new MySqlCommand(Query, conDataBase);
            MySqlDataReader myReader;

            try
            {
                conDataBase.Open();
                myReader = cmdDatabase.ExecuteReader();

                while (myReader.Read())
                {
                    string talentname = myReader.GetString("TalentName");
                    cb_Talents.Items.Add(talentname);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error: \r\n" + ex);
            }

        }

        private void cb_Talent_DropDownClosed_(object sender, EventArgs e)
        {
            string constring = "datasource = localhost; port = 3306; username = root; password = MyPass;";
            string Query = "SELECT * FROM dark_heresy.talents WHERE TalentName='" + cb_Talents.Text + "' ;";
            MySqlConnection conDataBase = new MySqlConnection(constring);
            MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
            MySqlDataReader myReader;

            try
            {
                conDataBase.Open();
                myReader = cmdDataBase.ExecuteReader();

                while (myReader.Read())
                {

                    string description = myReader.GetString("Description");
                    string strength = myReader.GetInt32("R_Str").ToString();
                    string weaponskill = myReader.GetInt32("R_WS").ToString();
                    string ballisticskill = myReader.GetInt32("R_BS").ToString();
                    string fellowship = myReader.GetInt32("R_Fel").ToString();
                    string perception = myReader.GetInt32("R_Per").ToString();
                    string intelligence = myReader.GetInt32("R_Int").ToString();
                    string agility = myReader.GetInt32("R_Agi").ToString();
                    string willpower = myReader.GetInt32("R_WP").ToString();
                    string toughness = myReader.GetInt32("R_Tough").ToString();


                    TextDescription.Text = description;
                    TextStrength.Text = strength;
                    TextWeaponskill.Text = weaponskill;
                    TextBallisticskill.Text = ballisticskill;
                    TextFellowship.Text = fellowship;
                    TextPerception.Text = perception;
                    TextIntelligence.Text = intelligence;
                    TextAgility.Text = agility;
                    TextWillpower.Text = willpower;
                    TextToughness.Text = toughness;



                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error: \r\n" + ex);
            }
        }
    }
}