日期:2014-05-16  浏览次数:20822 次

VS中无法转换类型?求解决
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 学生成绩管理系统
{
    public partial class Frmaddstu : Form
    {
        public string sid = "";
        public Frmaddstu(string id)
        {
            InitializeComponent();
            sid = id;
            try
            {
                DataSet ds = Classes.ClassInfoOperation.getClassInfo(new 学生成绩管理系统.ClassInfoData());
                comboBox2.DataSource = ds.Tables[0];
                comboBox2.ValueMember = "班级名称";
                comboBox2.DisplayMember = "班级名称";
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            if (sid != "")
            {
                StudentInfoData info = new 学生成绩管理系统.StudentInfoData();
                info.Sno = id;
                DataSet ds = classes.StudentInfoOperation.getStudentInfo(info);
                textBox1.Text = ds.Tables[0].Rows[0]["学号"].ToString();
                textBox2.Text = ds.Tables[0].Rows[0]["姓名"].ToString();
                textBox3.Text = ds.Tables[0].Rows[0]["出生日期"].ToString();
                comboBox1.SelectedItem = ds.Tables[0].Rows[0]["性别"].ToString;
                textBox4.Text = ds.Tables[0].Rows[0]["家庭住址"].ToString();
                textBox5.Text = ds.Tables[0].Rows[0]["家庭联系电话"].ToString();