涉及多个表的select语句中的错误 [英] error in the select statement involving multiple tables
本文介绍了涉及多个表的select语句中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
namespace EDAIF
{
public partial class Loanmaster : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Page Load Begins
if (!IsPostBack)
{
try
{
SqlConnection connect = new SqlConnection();
connect.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
connect.Open();
SqlDataAdapter da = new SqlDataAdapter("SELECT * ,
BRANCH.BRN_NAME,
TANK.TANK_NAME,
SECTORS.[SECTOR NAME]
FROM TANKMASTER
LEFT JOIN BRANCH ON
BRANCH.BRN_NO=LOANMASTER.BRN_nO
LEFT JOIN SECTORS ON
SECTORS.[SECTOR NUMBER]=LOANMASTER.SEC_NO
LEFT JOIN TANK ON
TANK.TANK_CODE=LOANMASTER.TANK_NO1
AND TANK.TANK_CODE=LOANMASTER.TANK_NO2
AND TANK.TANK_CODE=LOANMASTER.TANK_NO3", connect);
DataSet ds = new DataSet();
da.Fill(ds, "TANK");
选择语句中的错误请协助。新的c#
添加预
标签。
[/ Edit]
推荐答案
1.首先,您应该在SQL Server Management Studio中测试和优化您的SQL字符串;
2.然后你可以在C#代码中使用它,而你的C#代码似乎没问题。
PS:您应该在帖子中提供原始错误消息,以便为您提供更多建议。
1.First you should test and refine your SQL string in "SQL Server Management Studio";
2.Then you could use it in C# code, and you C# code seems to be OK.
PS: You should give the original error message in you post, in order to can give you more advises.
这篇关于涉及多个表的select语句中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文