Help For All .Net Developer
Help For All .Net Developer
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
' 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
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.Tables(0)
GETINDICE.DataSource = myDs1.Tables(0)
GETINDICE.DisplayMember = "t1"
mycmd1.Dispose()
mycmd.Dispose()
mycmd2.Dispose()
Else
Txbx_PL.ForeColor = ForeColor.DarkRed
perctextb.ForeColor = ForeColor.DarkRed
End If
Else
NSE_pl.ForeColor = ForeColor.DarkRed
NSE_perc.ForeColor = ForeColor.DarkRed
End If
Else
fo_pl.ForeColor = ForeColor.DarkRed
fo_percent.ForeColor = ForeColor.DarkRed
End If
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)
End If
Try
Dim t As Type = dg1.GetType
Dim m As Reflection.MethodInfo = t.GetMethod("ColAutoResize",
Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)
Catch ex As Exception
Trace.Write("Failed to resize column: " + ex.ToString + vbCrLf)
End Try