0
"POS"시스템에서해야 할 작업이 있습니다. 대신 이전 시스템 마녀는 VB 6.0 및 Access 였으므로 새로운 하나는 SQL Server, ADO.NET 및 C#을 사용하므로 BIXOLON 프린터에서 청구서를 인쇄하려고합니다.하지만 내 보고서를 디자인 할 때 올바르게 표시되지 않으면 다음과 같이 보입니다. 여기 내 테스트의 일부 샷입니다. 프로젝트 일부 코드 (이 내 진짜 프로젝트는 단지 테스트하지 않습니다) :BIXOLON SRP-350plusII에서 인쇄를 시도했지만 디자인이 올바르지 않습니다
private void ID()
{
cn.Open();
try
{
SqlCommand cmd = new SqlCommand("SELECT Max(ID)+1 FROM Info", cn);
cmd.ExecuteNonQuery();
int i = Convert.ToInt32(cmd.ExecuteScalar());
textBox1.Text = i.ToString();
}
catch
{
textBox1.Text = "1";
}
cn.Close();
}
private void LoadGrid()
{
dataGridView1.DataSource = null;
dataGridView1.Rows.Clear();
SqlDataAdapter ADAP = new SqlDataAdapter("Select * from Info", cn);
DataSet DS = new DataSet();
ADAP.Fill(DS, "Info");
dataGridView1.DataSource = DS.Tables["Info"];
textBox2.SelectAll();
textBox2.Focus();
}
private void Insert()
{
if (textBox2.Text != "")
{
SqlCommand cmd;
cn.Open();
cmd = new SqlCommand("INSERT INTO Info (Name, Date) VALUES (@Name, @Date)", cn);
cmd.Parameters.AddWithValue("@Name", textBox2.Text.Trim());
cmd.Parameters.AddWithValue("@Date", DateTime.Now.ToString());
cmd.ExecuteNonQuery();
cn.Close();
}
else
{
MessageBox.Show("Empty!");
textBox2.Focus();
}
}
private void Delete()
{
SqlCommand cmd = new SqlCommand("DELETE Info WHERE ID = @ID", cn);
cn.Open();
cmd.Parameters.AddWithValue("@ID", textBox1.Text);
cmd.ExecuteNonQuery();
cn.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'infoDataSet1.Info' table. You can move, or remove it, as needed.
this.InfoTableAdapter.Fill(this.infoDataSet1.Info);
LoadGrid();
ID();
this.reportViewer1.RefreshReport();
this.reportViewer1.RefreshReport();
}
private void button3_Click(object sender, EventArgs e)
{
LoadGrid();
}
private void button2_Click(object sender, EventArgs e)
{
Insert();
LoadGrid();
ID();
textBox2.Focus();
textBox2.Text = "";
}
private void textBox2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Insert();
LoadGrid();
ID();
textBox2.Focus();
textBox2.Text = "";
}
}
private void button1_Click(object sender, EventArgs e)
{
Delete();
LoadGrid();
ID();
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Rows.Count != 0)
{
button1.Enabled = true;
textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
textBox2.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
}
}
private void button4_Click(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'infoDataSet1.Info' table. You can move, or remove it, as needed.
this.InfoTableAdapter.Fill(this.infoDataSet1.Info);
this.reportViewer1.RefreshReport();
}
}
는 지금은 이런 식으로 그것을 만들기 위해 도움이 필요합니다 :