如何在命令文本框中指定此sql代码? [英] how to specify this sql code in the command text box?

查看:66
本文介绍了如何在命令文本框中指定此sql代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"SELECT course.Courseno, subject.PaperName
                                 FROM course INNER JOIN
                                    ids ON course.Courseno = ids.Courseno INNER JOIN
                                            subject ON ids.PaperID = subject.PaperID"



必须将其指定为command.commandtext =".......
我正在使用Windows窗体



it has to be specified as command.commandtext=".......
I am using windows forms

推荐答案

试试这个
SqlCommand command = new SqlCommand();
    command.CommandText = @"SELECT course.Courseno, subject.PaperName
                           FROM course INNER JOIN
                           ids ON course.Courseno = ids.Courseno INNER JOIN
                           subject ON ids.PaperID = subject.PaperID";

    command.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
Dataset ds = new Dataset();
da.fill(ds) ;
GridViewID.DataSource = ds.Tables[0];


这篇关于如何在命令文本框中指定此sql代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆