标题:SqlDataReader reader = com.ExecuteReader();
只看楼主
紫小念
Rank: 1
来 自:山东
等 级:新手上路
帖 子:27
专家分:0
注 册:2013-5-14
结帖率:60%
 问题点数:0 回复次数:0 
SqlDataReader reader = com.ExecuteReader();
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace pro3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string s = "server=.;database=SampleDb;integrated security=true;";
            SqlConnection conn = new SqlConnection(s);
            SqlCommand com = new SqlCommand();
            String sql = " select Name as 课程名称,Name as 学生姓名, Score as 考试成绩 from (Student inner join ExamScore on Student.Id=ExamScore.StudentId)inner join Lesson on ExamScore.LessonId=Lesson.Id ";
 
            textBox1.Text = sql;
             = sql;
            com.Connection = conn;
            //
            conn.Open();
            SqlDataReader reader = com.ExecuteReader();
            while (reader.Read()){
                String Lname = (String)reader["Name"];
                String Sname = (String)reader["Name"];
                int  Score=(int) reader["Score"];
            
            }
            reader.Close();
            conn.Close();

            

        }
    }
}
*****问题:  SqlDataReader reader = com.ExecuteReader();  “,”附近有错误。
搜索更多相关主题的帖子: database private public server 
2013-12-05 15:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-424739-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.503573 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved