Dim dtIncome As DataTable = New DataTable("Dt_Income")
dtIncome.Columns.Add("รหัสการวางแผน")
dtIncome.Columns.Add("ประเภท")
dtIncome.Columns.Add("จำนวน")
Dim Adapter As SqlCeDataAdapter
myConnection = New SqlCeConnection("Data Source =" _
+ (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase) + "\AppDatabase.sdf;"))
myConnection.Open()
Dim myCommand As SqlCeCommand = myConnection.CreateCommand()
' myCommand.CommandText = "SELECT * FROM [Account_Detail]WHERE date = '" + dateTime + "'"
myCommand.CommandText = "select D.Plan_ID,C.Type_Name,D.Type_ID,D.Plan_Money from (Account_Category as C inner join Planning as D on C.Type_ID=D.Type_ID) WHERE D.Month = '" + mm + "' and D.Year='" + yy + "' and D.Acc_ID='01'"
myCommand.CommandType = CommandType.Text
Adapter = New SqlCeDataAdapter(myCommand)
Adapter.Fill(dt)
dim id,money,typeid as string
id = dt.Rows(i)("Plan_ID")
money = dt.Rows(i)("Plan_Money")
typeid = dt.Rows(i)("Type_ID")
drnew = dtIncome.NewRow()
drnew("รหัสการวางแผน") = id
drnew("ประเภท") = name
drnew("จำนวน") = money
dtIncome.Rows.Add(drnew)
DataGrid1.DataSource = dtIncome