我不断收到以下错误消息:
Argument 1: cannot convert from 'System.Data.SqlClient.SqlDataAdapter' to 'System.Data.DataSet' and doesn't recognize the column name
我不太确定我做错了什么。此外,我不断收到一条错误消息,说它无法识别列名(对于 else if 语句)。这是在 Visal Studio 2017 中完成的。任何帮助将不胜感激。
使用 System.Windows.Forms;
使用 System.Data.SqlClient;
命名空间 WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (comboBox1.Text == "Plan_NAME")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and [Plan_NAME] LIKE '%" + textBox1.Text + "%'", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
else if (comboBox1.Text == "Admin_Name")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and [Admin_Name] LIKE '%" + textBox1.Text + "%'", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
else if (comboBox1.Text == "EIN_Number")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and [EIN_Number] LIKE '%" + textBox1.Text + "%'", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
else if (comboBox1.Text == "Number_Participants")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and ([Number_Participants] between '%" + textBox3.Text + "%' and '%" + textBox2.Text + "%')", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
else if (comboBox1.Text == "City")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and [City] LIKE '%" + textBox1.Text + "%'", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
else if (comboBox1.Text == "State")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and [State] LIKE '%" + textBox1.Text + "%'", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
else if (comboBox1.Text == "ZipCode")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and [ZipCode] LIKE '%" + textBox1.Text + "%'", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
else if (comboBox1.Text == "Total_Assets")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and ([Total_Assets] between '%" + textBox3.Text + "%' and '%" + textBox2.Text + "%')", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
else if (comboBox1.Text == "Net_Assets")
{
SqlConnection con = new SqlConnection("Data Source=server2016;Initial Catalog=ProjectRD;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
SqlDataAdapter sda = new SqlDataAdapter("select concat(dbo.[5500].plan_name, dbo.[5500_SF_NEW].SF_PLAN_NAME) as [Plan_NAME], concat(dbo.[5500].ADMIN_CARE_OF_NAME, dbo.[5500_SF_NEW].SF_ADMIN_CARE_OF_NAME) as [Admin_Name], concat(dbo.[5500].SPONS_DFE_EIN, dbo.[5500_SF_NEW].SF_SPONS_EIN) as [EIN_Number], concat(dbo.[5500].SPONS_DFE_PN, dbo.[5500_SF_NEW].SF_PLAN_NUM) as [Plan_Number], concat(dbo.[5500].TOT_ACT_RTD_SEP_BENEF_CNT, dbo.[5500_SF_NEW].SF_TOT_ACT_PARTCP_EOY_CNT) as [Number_Participants], concat(concat( (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS1), (dbo.[5500].SPONS_DFE_MAIL_US_ADDRESS2)) ,concat((dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS1]), (dbo.[5500_SF_NEW].[SF_SPONS_US_ADDRESS2]) )) as [Address], concat(dbo.[5500].SPONS_DFE_MAIL_US_CITY, (dbo.[5500_SF_NEW].[SF_SPONS_US_CITY] ))as [City], concat(dbo.[5500].SPONS_DFE_MAIL_US_STATE, dbo.[5500_SF_NEW].[SF_SPONS_US_STATE])as [State], concat(dbo.[5500].SPONS_DFE_MAIL_US_ZIP, (dbo.[5500_SF_NEW].[SF_SPONS_US_ZIP]) )as [ZipCode], ((isNull(dbo.SCH_H.TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_ASSETS_EOY_AMT,0))) as [Total_Assets], ((isNull(dbo.SCH_H.NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_NET_ASSETS_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_NET_ASSETS_EOY_AMT,0)) ) as [Net_Assets], ((isNull(dbo.SCH_H.TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.SCH_I.SMALL_TOT_LIABILITIES_EOY_AMT, 0)) + (isNull(dbo.[5500_SF_NEW].SF_TOT_LIABILITIES_EOY_AMT,0)) ) as [Total_Liabilities] from dbo.[5500] full join dbo.sch_h on dbo.[5500].ack_id = dbo.sch_h.ack_id full join dbo.SCH_I on dbo.[5500].ACK_ID = dbo.sch_i.ACK_ID full join dbo.[5500_SF_NEW] on dbo.[5500].ACK_ID = dbo.[5500_SF_NEW].ACK_ID where (dbo.[5500_SF_NEW].SF_PLAN_NAME in (Select Sf_Plan_name from Temp_Targets_SF) or dbo.[5500].PLAN_NAME in (Select Plan_Name from Temp_Targets)) and ([Net_Assets] between '%" + textBox3.Text + "%' and '%" + textBox2.Text + "%')", con);
DataTable data = new DataTable();
sda.Fill(data);
dataGridView1.DataSource = data;
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label4_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged_1(object sender, EventArgs e)
{
}
private void textBox2_TextChanged_1(object sender, EventArgs e)
{
}
private void textBox3_TextChanged_1(object sender, EventArgs e)
{
}
}
}