Anda di halaman 1dari 4

Dim myconnection As New SqlClient.

SqlConnection
Dim mycmd As New SqlClient.SqlCommand
Dim mycmd1 As New SqlClient.SqlCommand
Dim mycmd2 As New SqlClient.SqlCommand
Dim mycmd3 As New SqlClient.SqlCommand
Dim mycmd4 As New SqlClient.SqlCommand
Dim mycmd5 As New SqlClient.SqlCommand

Dim myDs As New DataSet


Dim myDs1 As New DataSet
Dim myDs2 As New DataSet
Dim myDs3 As New DataSet
Dim myDs4 As New DataSet
Dim myDs5 As New DataSet

Dim myda As New SqlClient.SqlDataAdapter


Dim myda1 As New SqlClient.SqlDataAdapter
Dim myda2 As New SqlClient.SqlDataAdapter
Dim myda3 As New SqlClient.SqlDataAdapter
Dim myda4 As New SqlClient.SqlDataAdapter
Dim myda5 As New SqlClient.SqlDataAdapter

' myconnection.ConnectionString =
"server=192.9.202.166;database=power_view;uid=sa;pwd=db2admin"
myconnection.ConnectionString =
"server=192.9.202.72;database=power_view;uid=sa;pwd=db2admin"

mycmd.Connection = myconnection
mycmd1.Connection = myconnection
mycmd2.Connection = myconnection
mycmd3.Connection = myconnection
mycmd4.Connection = myconnection
mycmd5.Connection = myconnection

mycmd.CommandType = CommandType.StoredProcedure
mycmd1.CommandType = CommandType.StoredProcedure
mycmd2.CommandType = CommandType.StoredProcedure
mycmd3.CommandType = CommandType.StoredProcedure
mycmd4.CommandType = CommandType.StoredProcedure
mycmd5.CommandType = CommandType.StoredProcedure

mycmd.CommandText = "getprice_cash_fut_opt"
mycmd.Parameters.Add("@Userid", SqlDbType.VarChar).Value = guserid
mycmd1.CommandText = "getindicesprice"
mycmd2.CommandText = "GetTotal_figurevalue_nse"
mycmd2.Parameters.Add("@Userid", SqlDbType.VarChar).Value = guserid
mycmd3.CommandText = "GetTotal_figurevalue_bse"
mycmd3.Parameters.Add("@Userid", SqlDbType.VarChar).Value = guserid
mycmd4.CommandText = "GetTotal_figurevalue_fonse"
mycmd4.Parameters.Add("@Userid", SqlDbType.VarChar).Value = guserid
mycmd5.CommandText = "GetTotal_figurevalue_option"
mycmd5.Parameters.Add("@Userid", SqlDbType.VarChar).Value = guserid

myda.SelectCommand = mycmd
myda1.SelectCommand = mycmd1
myda2.SelectCommand = mycmd2
myda3.SelectCommand = mycmd3
myda4.SelectCommand = mycmd4
myda5.SelectCommand = mycmd5

myda.Fill(myDs, "Existing MartkeWatch")


myda1.Fill(myDs1)
myda2.Fill(myDs2)
myda3.Fill(myDs3)
myda4.Fill(myDs4)
myda5.Fill(myDs5)

Txbox_totinvest.Text = myDs2.Tables(0).Rows(0).Item(0)
Txbox_Currentval.Text = myDs2.Tables(0).Rows(0).Item(1)
Txbx_PL.Text = myDs2.Tables(0).Rows(0).Item(2)
perctextb.Text = myDs2.Tables(0).Rows(0).Item(3)

NSE_TOTAL_Invest.Text = myDs3.Tables(0).Rows(0).Item(0)
NSE_Current_val.Text = myDs3.Tables(0).Rows(0).Item(1)
NSE_pl.Text = myDs3.Tables(0).Rows(0).Item(2)
NSE_perc.Text = myDs3.Tables(0).Rows(0).Item(3)

FO_TOTAL_Invet.Text = myDs4.Tables(0).Rows(0).Item(0)
Fo_current_val.Text = myDs4.Tables(0).Rows(0).Item(1)
fo_pl.Text = myDs4.Tables(0).Rows(0).Item(2)
fo_percent.Text = myDs4.Tables(0).Rows(0).Item(3)

OPT_TOTAL_INVEST.Text = myDs5.Tables(0).Rows(0).Item(0)
OPT_CURRENT_VAL.Text = myDs5.Tables(0).Rows(0).Item(1)
OPT_PL.Text = myDs5.Tables(0).Rows(0).Item(2)
OPT_PERC.Text = myDs5.Tables(0).Rows(0).Item(3)

' dg1.DataSource = myDs


Dim ts As New DataGridTableStyle
ts.MappingName = myDs.Tables(0).TableName

dg1.DataSource = myDs.Tables(0)
GETINDICE.DataSource = myDs1.Tables(0)
GETINDICE.DisplayMember = "t1"

mycmd1.Dispose()
mycmd.Dispose()
mycmd2.Dispose()

If myDs2.Tables(0).Rows(0).Item(0) < myDs2.Tables(0).Rows(0).Item(1) Then


picup.Visible = True
ElseIf myDs2.Tables(0).Rows(0).Item(0) > myDs2.Tables(0).Rows(0).Item(1)
Then
picdown.Visible = True
Else
Picsame.Visible = True
End If

If myDs3.Tables(0).Rows(0).Item(0) < myDs3.Tables(0).Rows(0).Item(1) Then


bse_pic_up.Visible = True
ElseIf myDs3.Tables(0).Rows(0).Item(0) > myDs3.Tables(0).Rows(0).Item(1)
Then
bse_pic_down.Visible = True
Else
bse_pic_same.Visible = True
End If

If myDs4.Tables(0).Rows(0).Item(0) < myDs4.Tables(0).Rows(0).Item(1) Then


fo_pic_up.Visible = True
ElseIf myDs4.Tables(0).Rows(0).Item(0) > myDs4.Tables(0).Rows(0).Item(1)
Then
fo_pic_down.Visible = True
Else
fo_pic_same.Visible = True
End If

If myDs5.Tables(0).Rows(0).Item(0) < myDs5.Tables(0).Rows(0).Item(1) Then


opt_up.Visible = True
ElseIf myDs5.Tables(0).Rows(0).Item(0) > myDs5.Tables(0).Rows(0).Item(1)
Then
opt_down.Visible = True
Else
opt_same.Visible = True
End If

If CLng(Txbox_totinvest.Text) < CLng(Txbox_Currentval.Text) Then


Txbx_PL.ForeColor = ForeColor.DarkGreen
perctextb.ForeColor = ForeColor.DarkGreen

Else
Txbx_PL.ForeColor = ForeColor.DarkRed
perctextb.ForeColor = ForeColor.DarkRed

End If

If CLng(NSE_TOTAL_Invest.Text) < CLng(NSE_Current_val.Text) Then


NSE_pl.ForeColor = ForeColor.DarkGreen
NSE_perc.ForeColor = ForeColor.DarkGreen

Else
NSE_pl.ForeColor = ForeColor.DarkRed
NSE_perc.ForeColor = ForeColor.DarkRed

End If

If CLng(FO_TOTAL_Invet.Text) < CLng(Fo_current_val.Text) Then


fo_pl.ForeColor = ForeColor.DarkGreen
fo_percent.ForeColor = ForeColor.DarkGreen

Else
fo_pl.ForeColor = ForeColor.DarkRed
fo_percent.ForeColor = ForeColor.DarkRed
End If

If CLng(OPT_TOTAL_INVEST.Text) < CLng(OPT_CURRENT_VAL.Text) Then


OPT_PL.ForeColor = ForeColor.DarkGreen
OPT_PERC.ForeColor = ForeColor.DarkGreen

Else
OPT_PL.ForeColor = ForeColor.DarkRed
OPT_PERC.ForeColor = ForeColor.DarkRed
End If

txbx_total_invest.Text = myDs2.Tables(0).Rows(0).Item(0) +
myDs3.Tables(0).Rows(0).Item(0) + myDs4.Tables(0).Rows(0).Item(0) +
myDs5.Tables(0).Rows(0).Item(0)
txbx_current_val.Text = myDs2.Tables(0).Rows(0).Item(1) +
myDs3.Tables(0).Rows(0).Item(1) + myDs4.Tables(0).Rows(0).Item(1) +
myDs5.Tables(0).Rows(0).Item(1)
txbx_gross_pl.Text = txbx_current_val.Text - txbx_total_invest.Text
txbx_perc.Text = CInt(100 * txbx_gross_pl.Text / txbx_total_invest.Text)
'txbx_TODAY_pl.Text =myds.Tables(0).Rows.C
Dim ii As Integer
Dim jj As Integer
jj = 0
For ii = 0 To myDs.Tables(0).Rows.Count - 1
jj = myDs.Tables(0).Rows(ii).Item("TodayPL") + jj
Next
txbx_TODAY_pl.Text = jj
txbx_TODAY_perc.Text = CInt(100 * jj / txbx_total_invest.Text)

If txbx_total_invest.Text < txbx_current_val.Text Then


txbx_gross_pl.ForeColor = ForeColor.DarkGreen
txbx_perc.ForeColor = ForeColor.DarkGreen
Else
txbx_gross_pl.ForeColor = ForeColor.DarkRed
txbx_perc.ForeColor = ForeColor.DarkRed
End If

If txbx_total_invest.Text < txbx_current_val.Text Then


gross_pic_up.Visible = True
ElseIf txbx_total_invest.Text > txbx_current_val.Text Then
gross_pic_down.Visible = True
Else
gross_pic_same.Visible = True

End If

Try
Dim t As Type = dg1.GetType
Dim m As Reflection.MethodInfo = t.GetMethod("ColAutoResize",
Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)

Dim i As Integer = dg1.FirstVisibleColumn


Dim j As Integer = dg1.VisibleColumnCount
Do While i < j
m.Invoke(dg1, New Object() {i})
i = i + 1
Loop

Catch ex As Exception
Trace.Write("Failed to resize column: " + ex.ToString + vbCrLf)
End Try

Anda mungkin juga menyukai