| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 643 人关注过本帖
标题: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
快速回复:SqlDataReader reader = com.ExecuteReader();
数据加载中...
 
   



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

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