Click here to Skip to main content
15,885,032 members
Home / Discussions / C#
   

C#

 
Questionc# to control microphone volume Pin
NAVIN KUMAR RAMASWAMY1-Jul-14 4:08
NAVIN KUMAR RAMASWAMY1-Jul-14 4:08 
AnswerRe: c# to control microphone volume Pin
Pete O'Hanlon1-Jul-14 4:24
mvePete O'Hanlon1-Jul-14 4:24 
Questionself destructible message Pin
abhisince941-Jul-14 3:32
abhisince941-Jul-14 3:32 
AnswerRe: self destructible message Pin
joost.versteegen1-Jul-14 3:41
joost.versteegen1-Jul-14 3:41 
GeneralRe: self destructible message Pin
Rob Philpott1-Jul-14 4:31
Rob Philpott1-Jul-14 4:31 
AnswerRe: self destructible message Pin
ZurdoDev1-Jul-14 3:58
professionalZurdoDev1-Jul-14 3:58 
AnswerRe: self destructible message Pin
Dan Neely3-Jul-14 9:18
Dan Neely3-Jul-14 9:18 
QuestionJoin data table with sql table Pin
Mohammad Soleimani1-Jul-14 1:40
Mohammad Soleimani1-Jul-14 1:40 
Hi,I have 2 Data Table and on Table Joined from Database Tables By Query
I use 3 Layer Programming

My Report Class DAL Like Below

<pre lang="c#">using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DAL
{

public class _Report:SQLActivity
{
public int identity = 0;
public string Table = "";
public int DatasetLink = 0;
DataSet ds = new DataSet("Report");
DataTable dtObject = new DataTable("dtObject");
DataTable dtWarehouse = new DataTable("dtWarehouse");

public void Crate_DataTable()
{

//point 1
switch (DatasetLink)
{
case 0:
{//Coding
DataColumn[] columns = new DataColumn[0];
dtObject.Columns.Add("identity", typeof(int));
dtObject.Columns.Add("iD", typeof(int));
dtObject.Columns.Add("Title", typeof(string));
dtObject.PrimaryKey = columns;

ds.Tables.Add(dtObject);
}
break;

case 9:
{//Warehouse
DataColumn[] columns = new DataColumn[0];
dtWarehouse.Columns.Add("identity", typeof(int));
dtWarehouse.Columns.Add("iD", typeof(int));
dtWarehouse.Columns.Add("Title", typeof(string));
dtWarehouse.PrimaryKey = columns;
ds.Tables.Add(dtWarehouse);
}
break;

}

}
public void AddNew_SelectDatatable_Row(int identity, int iD, string Title)
{
switch (DatasetLink)
{
case 0:
{//Coding
dtObject.Rows.Add(new object[] { identity,iD, Title });

}
break;
case 9:
{//Warehouse
dtWarehouse.Rows.Add(new object[] { identity, iD, Title });
}
break;

}


}

public int Delete_SelectDatatable_Row(int iD)
{
//point 2

switch (DatasetLink)
{
case 0:
{//Coding
DataRow[] drr = dtObject.Select("iD=' " + iD + " ' ");
foreach (var row in drr)
row.Delete();
}
break;

case 9:
{//Warehouse
DataRow[] drr = dtWarehouse.Select("iD=' " + iD + " ' ");
foreach (var row in drr)
row.Delete();
}
return 1;
}

public DataTable Get_Update_SelectDatatable()
{


switch (DatasetLink)
{
case 0:
{//Coding
Table = "dtObject";
}
break;
case 9:
{//Warehouse
Table = "dtWarehouse";
}
break;


return ds.Tables[Table];
}

public int GetFind_SelectDatatable_iD(int iD)
{
int retval = 0;
switch (DatasetLink)
{
case 0:
{//Coding
foreach (DataRow row in dtObject.Rows)
{
if (row["iD"].ToString() == iD + "")
{
retval = 1;
}
}
}
break;
case 9:
{//Warehouse
foreach (DataRow row in dtWarehouse.Rows)
{
if (row["iD"].ToString() == iD+"")
{
retval = 1 ;
}
}
}
break;


return retval;

}



public DataTable Report_WarehouseStore()
{

SqlDataAdapter da =new SqlDataAdapter (@"SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD INNER JOIN dtObject ON dtObject.iD =WarehouseStore.ProductCode INNER JOIN dtWarehouse ON dtWarehouse.iD =WarehouseStore.WarehouseiD",new _Connections().Cnn);
DataTable dt=new DataTable();
da.Fill(dt);
ds.Tables.Add(dt);
ds.Tables.Add(dtObject);
ds.Tables.Add(dtWarehouse);
return dt;

}

}
}</pre>

I'm Confused How i can run this Query On Data set and Return Data table
<pre lang="SQL">SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD INNER JOIN dtObject ON dtObject.iD =WarehouseStore.ProductCode INNER JOIN dtWarehouse ON dtWarehouse.iD =WarehouseStore.WarehouseiD</pre>

<pre lang="c#">
Data "dtObject" and "dtWarehouse" insert by User. i want select data from WarehoseStore when WarehoseStore.ProductCode=dtObject.iD and WarehouseStore.WarehouseiD=dtWarehouse.iD

if dtObject database table is this can work but now i cant run query on this position.

when is run this Query </pre>

<pre lang="SQL">SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD</pre>

I have no problem but when add this Query to above code
INNER JOIN dtObject ON dtObject.iD =WarehouseStore.ProductCode INNER JOIN dtWarehouse ON dtWarehouse.iD =WarehouseStore.WarehouseiD

My problem will start
AnswerRe: Join data table with sql table Pin
Eddy Vluggen1-Jul-14 7:25
professionalEddy Vluggen1-Jul-14 7:25 
GeneralRe: Join data table with sql table Pin
Mohammad Soleimani2-Jul-14 1:31
Mohammad Soleimani2-Jul-14 1:31 
GeneralRe: Join data table with sql table Pin
Eddy Vluggen2-Jul-14 3:06
professionalEddy Vluggen2-Jul-14 3:06 
GeneralRe: Join data table with sql table Pin
Mohammad Soleimani2-Jul-14 6:22
Mohammad Soleimani2-Jul-14 6:22 
QuestionSystem.AccessViolationException When Using Win32 DLL Pin
Django_Untaken1-Jul-14 0:36
Django_Untaken1-Jul-14 0:36 
AnswerRe: System.AccessViolationException When Using Win32 DLL Pin
OriginalGriff1-Jul-14 2:40
mveOriginalGriff1-Jul-14 2:40 
GeneralRe: System.AccessViolationException When Using Win32 DLL Pin
Django_Untaken1-Jul-14 8:49
Django_Untaken1-Jul-14 8:49 
AnswerRe: System.AccessViolationException When Using Win32 DLL Pin
Bernhard Hiller1-Jul-14 20:38
Bernhard Hiller1-Jul-14 20:38 
GeneralRe: System.AccessViolationException When Using Win32 DLL Pin
Django_Untaken1-Jul-14 21:36
Django_Untaken1-Jul-14 21:36 
Questionhow to solve this Error...in insert query Pin
Nishant.Chauhan8030-Jun-14 21:50
Nishant.Chauhan8030-Jun-14 21:50 
AnswerRe: how to solve this Error...in insert query Pin
Rob Philpott30-Jun-14 22:40
Rob Philpott30-Jun-14 22:40 
AnswerRe: how to solve this Error...in insert query Pin
AjayJamwal2-Jul-14 3:20
professionalAjayJamwal2-Jul-14 3:20 
QuestionExecuting few lines of code on Windows Store app installation Pin
Sharath C V30-Jun-14 21:14
professionalSharath C V30-Jun-14 21:14 
AnswerRe: Executing few lines of code on Windows Store app installation Pin
Pete O'Hanlon30-Jun-14 23:19
mvePete O'Hanlon30-Jun-14 23:19 
GeneralRe: Executing few lines of code on Windows Store app installation Pin
Sharath C V1-Jul-14 0:34
professionalSharath C V1-Jul-14 0:34 
GeneralRe: Executing few lines of code on Windows Store app installation Pin
Pete O'Hanlon1-Jul-14 1:31
mvePete O'Hanlon1-Jul-14 1:31 
QuestionMSI installer, deployment Pin
ankum1630-Jun-14 18:17
ankum1630-Jun-14 18:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.