 |
|
สอบถามเรื่อง การดึงข้อมูลในฐานข้อมูลมา คำนวณค่าพยากรณ์ ใช้tool ในการดึง DB |
|
 |
|
|
 |
 |
|

Code :: แบบนี้ ไม่ทราบว่าผิดตรงไหนยังไง ขอบคุณคะ
อยากให้มันดึงค่ามาคำนวณ พยากรณ์ได้
Code (VB.NET)
Public Class FormForecast
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
FormDetilFor.Show()
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
MessageBox.Show("คุณต้องการออกจากหน้านี้", "ข้อความจากระบบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
Me.Close()
End Sub
Private Sub FormForecast_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'FORECASTDataSet3.Transection' table. You can move, or remove it, as needed.
Me.TransectionTableAdapter1.Fill(Me.FORECASTDataSet3.Transection)
'TODO: This line of code loads data into the 'FORECASTDataSet2.Product' table. You can move, or remove it, as needed.
Me.ProductTableAdapter1.Fill(Me.FORECASTDataSet2.Product)
'TODO: This line of code loads data into the 'FORECASTDataSet2.Transection' table. You can move, or remove it, as needed.
Me.TransectionTableAdapter.Fill(Me.FORECASTDataSet2.Transection)
'TextBox1.Text = ComboBox1.SelectedValue
End Sub
Private Sub FillByToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.ProductTableAdapter.FillBy(Me.TransectionDataSet.Product)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub FillBy2ToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.TransectionTableAdapter.FillBy2(Me.FORECASTDataSet2.Transection)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub ProductIDToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.TransectionTableAdapter.ProductID(Me.FORECASTDataSet2.Transection)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
TextBox1.Text = ComboBox1.SelectedValue
End Sub
Private Sub FillBy1ToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.ProductTableAdapter.FillBy1(Me.TransectionDataSet.Product)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub FillBy2ToolStripButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.ProductTableAdapter.FillBy2(Me.TransectionDataSet.Product)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
End Sub
Private Sub FillBy3ToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.ProductTableAdapter.FillBy3(Me.TransectionDataSet.Product)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioMonth.CheckedChanged
'If RadioMonth = ComboBox2 Then
' RadioMonth.Checked = True
'ElseIf RadioMonth = Then
' RadioButton2.Checked = False
'End If
'RadioMonth = ComboBox2.SelectedValue
End Sub
End Class
Tag : .NET, Ms SQL Server 2008, Win (Windows App), VS 2008 (.NET 3.x)
|
|
 |
 |
 |
 |
Date :
2013-04-24 15:55:11 |
By :
มินนี่ |
View :
1153 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สิ่งที่ ทำไม่ได้คือ
ส่วนที่ 2 คือ ข้อมูลสินค้าที่ต้องการ เมื่อเลือก ว่า จะคำนวณแบบไหน
คลิก รายเดือน แล้วให้เลือกใน combobox 12 เดือนแต่ยังทำไม่ได้
เมื่อ คลิก รายไตรมาส ให้ select เดือน 12/4 โดยกำหนดค่าว่เดือนไหนถึงเดือนไหนคือ ไตรมาสใดแล้ว sum รวม
คลิกรายปี แสดงหน้า sum ทั้งปีออกมา *** แต่ยังทำไม่ได้
ดึง DB ใน Tool มาใช้ไม่ถูกคะ
แล้ว เมื่อกด เลือกแล้ว กด พยากรณ์ ให้ ค่าผลลัพธ์ ขึ้น ในช่อง " ผลการพยากรณ์"
|
 |
 |
 |
 |
Date :
2013-04-24 16:01:31 |
By :
มินนี่ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมเคยทำ แต่ผมไม่รูจริงฯว่า ดีที่สุดหรือไม่?
RDBMS สมมุติว่าชื่อ xxx
---- TableMonth12 Field MonthFild int
---- TableMonth12.MonthField
-------- 1
-------- 2
-------- 3
...
-------- 12
Select * from TableMonth12 As a Left Join (Select Sum(x.a) Ass a , Sum(x.b) Ass b From TableXXXX As x) As tblXXX
On a.ID = tblXXX.ID
|
 |
 |
 |
 |
Date :
2013-04-25 10:13:36 |
By :
ผ่านมา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|