In the code below, I am executing 2 stored procs that are returning row
counts.... I am storing a summary of the row counts into a Textbox... why,
when I am adding Salespeople (the first section of code) does it return a 0
before the text messages I have programmed ?
It returns the following to the Textbox when "Adding Salespeople"
0
Number of rows added to SalespersonMaster = 12
However, it just returns the row counts as follows with no leading 0 when
adding the Sales data ?
Number of rows added to SalesTrnDetail = 125
Number of rows added to CommissionDetail for Salesperson0 = 125....
Thanks !
__________________________________________________ ____________________-
cn.Open()
' Add Salespeople ----------------------------------------------
Dim cmds As New OleDbCommand
cmds = cn.CreateCommand()
cmds.CommandText = "sp_1"
cmds.CommandType = CommandType.StoredProcedure
cmds.Parameters.Add("@OutCntSalespersons", SqlDbType.Int).Direction
= ParameterDirection.Output
Dim drs As OleDbDataReader = cmds.ExecuteReader()
Do While drs.Read
txtMessages.AppendText(drs(0).ToString & ControlChars.CrLf)
Loop
drs.Close()
'Populate TextBox1 with Row Counts
txtMessages.AppendText("Number of rows added to SalespersonMaster =
" & cmds.Parameters("@OutCntSalespersons").Value.ToStr ing &
ControlChars.CrLf)
' End Add Salespeople ----------------------------------------------
' Add Sales Data --------------------------------------------------
Dim cmd As New OleDbCommand
cmd = cn.CreateCommand()
cmd.CommandText = "sp_2"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@OutCntSalesTrnDetail", SqlDbType.Int).Direction
= ParameterDirection.Output
cmd.Parameters.Add("@OutCntCommissionDetailSalespe rson0",
SqlDbType.Int).Direction = ParameterDirection.Output
cmd.Parameters.Add("@OutCntCommissionDetailSalespe rson1",
SqlDbType.Int).Direction = ParameterDirection.Output
cmd.Parameters.Add("@OutCntCommissionDetailSalespe rson2",
SqlDbType.Int).Direction = ParameterDirection.Output
cmd.Parameters.Add("@OutCntCommissionDetailSalespe rson3",
SqlDbType.Int).Direction = ParameterDirection.Output
Dim dr As OleDbDataReader = cmd.ExecuteReader()
Do While dr.Read
txtMessages.AppendText(dr(0).ToString & ControlChars.CrLf)
Loop
dr.Close()
'Populate TextBox1 with Row Counts
txtMessages.AppendText("Number of rows added to SalesTrnDetail = " &
cmd.Parameters("@OutCntSalesTrnDetail").Value.ToSt ring & ControlChars.CrLf)
txtMessages.AppendText("Number of rows added to CommissionDetail for
Salesperson0 = " &
cmd.Parameters("@OutCntCommissionDetailSalesperson 0").Value.ToString &
ControlChars.CrLf)
txtMessages.AppendText("Number of rows added to CommissionDetail for
Salesperson1 = " &
cmd.Parameters("@OutCntCommissionDetailSalesperson 1").Value.ToString &
ControlChars.CrLf)
txtMessages.AppendText("Number of rows added to CommissionDetail for
Salesperson2 = " &
cmd.Parameters("@OutCntCommissionDetailSalesperson 2").Value.ToString &
ControlChars.CrLf)
txtMessages.AppendText("Number of rows added to CommissionDetail for
Salesperson3 = " &
cmd.Parameters("@OutCntCommissionDetailSalesperson 3").Value.ToString &
ControlChars.CrLf)
'End Add Sales
Data --------------------------------------------------
cn.Close()