관련 칼럼을 통해 DataTable과 관련이 있다는 것을 알고 있습니다 ... 약간의 문제가 있지만.DataTable과 다른 C#을 연결할 수 없습니다.
예 :
부모 테이블 - 고객 -> {CUSTOMERNAME, customerCode (PK), telphoneCell, ... 등}
아동 표 - 주문 -> {customerCode, orderCode (PK) dateStart, dateEnd, ... 등} 지금
...
손자 표 (들) - ManufacturingSheet -> {panelNumber, panelWidth, panelHeight, ... 등}
사용자 입력에서 계산 한 볼트 & 너트와 같은 부품의 양을 표시하는 텍스트 상자가 있습니다.
그래서이 전체 양식을 한 고객이 주문한 내용에 저장할 수 있습니까? 고객 이름, 코드 및 날짜 세부 정보 등도이 서식에 나타납니다.
테이블에 texbox를 연결할 수 있다고해도 양식의 나머지 부분에 어떻게 연결합니까? 여기
는 코드 나 데이터베이스에 저장하려는 모든 그리드 & 텍스트 상자를 표시 :using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PalisadeWorld
{
public partial class ManufacturingSheet : Form
{
public ManufacturingSheet()
{
InitializeComponent();
}
//all the calculated sizes, and parts
public string[] dis_Width { get; set; }
public string[] dis_Height { get; set; }
public string[] dis_Comments { get; set; }
public int[] dis_PaleQty { get; set; }
public int[] dis_Blocks { get; set; }
public int dis_num { get; set; }
//Method to Convert a string array to int array
private int[] ConvertArray(string[] s, int rows)
{
int[] intArray = new int[rows];
for (int x = 0; x < rows; x++)
{
intArray[x] = Convert.ToInt32(s[x]);
}
return intArray;
}
//Methods returning other parts calculated with sizes above
private int GetTotalBearers(string[] bearers, int rows)
{
int i;
int totalBearers = 0;
int[] temp = ConvertArray(bearers, rows);
for (i = 0; i < rows; i++)
{
if (temp[i] >= 2200)
{
totalBearers += 6;
}
else totalBearers += 4;
}
return totalBearers;
}
private int GetTotalPales(int[] pales, int rows)
{
int i;
int totalPales = 0;
for (i = 0; i < rows; i++)
{
totalPales += pales[i];
}
return totalPales;
}
private int GetTotalBoltsNutsBrackest(int[] pales, int rows)
{
int totalBolts = GetTotalPales(pales, rows) + (rows * 4);
return totalBolts;
}
private void ManufacturingSheet_Load(object sender, EventArgs e)
{
//displaying number of respective parts
numBearers.Text = string.Format("{0}", GetTotalBearers(dis_Height, dis_num));
numPales.Text = string.Format("{0}", GetTotalPales(dis_PaleQty, dis_num));
numBrackets.Text = numBearers.Text;
numBoltsNutsWashers.Text = string.Format("{0}", GetTotalBoltsNutsBrackest(dis_PaleQty, dis_num));
int i;
int no = 0;
//displaying sizes etc in DataGrid
for(i = 0; i < dis_num; i++)
{
// Create a new row.
PalisadeWorldDatabaseDataSet.ManufacturingSheetRow newOutputRow;
newOutputRow = palisadeWorldDatabaseDataSet1.ManufacturingSheet.NewManufacturingSheetRow();
newOutputRow.no = ++no ;
newOutputRow.cutSize = string.Format("{0}", dis_Width[i]);
newOutputRow.block = string.Format("{0}", dis_Blocks[i]);
newOutputRow.height = string.Format("{0}", dis_Height[i]);
newOutputRow.palesQty = string.Format("{0}", dis_PaleQty[i]);
newOutputRow.comments = string.Format("{0}", dis_Comments[i]);
// Add the row to the Region table
this.palisadeWorldDatabaseDataSet1.ManufacturingSheet.Rows.Add(newOutputRow);
// Save the new row to the database
this.manufacturingSheetTableAdapter.Update(this.palisadeWorldDatabaseDataSet1.ManufacturingSheet);
this.manufacturingSheetTableAdapter.Fill(this.palisadeWorldDatabaseDataSet1.ManufacturingSheet);
}
}
}
은}
: GUI를 질문, 일반적으로는 OrderItems에에게 테이블 (종종 OrderDetail 이름을) 할 것이다 당신이 주문에 하나 개 이상의 항목을 캡처하는 데이터 그리드를 사용하는 것이 관해서는
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.aspx
** ManufacturingSheet **는 데이터 집합이 아닌 보고서의 내용이지만 고객의 세부 정보로 저장해야합니다. –