>>> s = 'https://fire.vimeocdn.com/.../159463108/video/499604330/playlist.m3u8'
>>> s.rsplit('/', 1)[0]
'https://fire.vimeocdn.com/.../159463108/video/499604330'
错误是:
Imports System.Data.SqlClient
Imports System.Configuration
Public Class frmStatement
Public compName As String
Dim pfield, pfield1, pfield2 As New ParameterField
Dim pfields As New ParameterFields
Dim an1, an2, an3 As String
Dim answer1 As Double
Dim pdiscrete, pdiscrete1, pdiscrete2 As New ParameterDiscreteValue
Private Sub frmStatement_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim rpt As New rptStatementUnpaidPart 'The report you created. sub report1
Dim rpt1 As New rptStatementPaidPart()
Dim myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("bookStore.My.MySettings.db_bookStoreConnectionString").ConnectionString)
Dim MyCommand As New SqlCommand()
Dim myDA As New SqlDataAdapter()
Dim myDS As New dsBill 'The DataSet you created.
Dim cmd As New SqlCommand
Dim adp As New SqlDataAdapter
Dim ds As New dsBillDetails
Dim adp1 As New SqlDataAdapter
Dim ds1 As New dsCustomerInfo
If myConnection.State = ConnectionState.Closed Then myConnection.Open()
Try
MyCommand.Connection = myConnection
MyCommand.CommandText = "SELECT * FROM tbl_bill where status='unpaid' or status='partial paid' and companyName ='" + compName + "'"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
' myDS.Tables().Clear()
myDA.Fill(myDS, "Customers")
rpt.SetDataSource(myDS.Tables(1)) 'datasource1
' CrystalReportViewer1.ReportSource = rpt
Catch Excep As InvalidCastException
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
myConnection.Close()
If myConnection.State = ConnectionState.Closed Then myConnection.Open()
Try
cmd.Connection = myConnection
cmd.CommandText = "SELECT * FROM tbl_bill where status='paid'or status ='Credit' and companyName ='" + compName + "'"
cmd.CommandType = CommandType.Text
adp.SelectCommand = cmd
' ds.Tables.Clear()
adp.Fill(ds, "newTable")
' Form2.a = ds.Tables("newTable")
rpt1.SetDataSource(ds.Tables(1))
' CrystalReportViewer1.ReportSource = rpt1
Catch ex As InvalidCastException
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
myConnection.Close()
If myConnection.State = ConnectionState.Closed Then myConnection.Open()
Dim orpt As New rptStatementMain
'total for val 1
' Dim daMyName As New SqlDataAdapter
'Dim dsMyName As New DataSet
Dim answer As Double
Dim mySelectQuery As String = "Select SUM (total) FROM tbl_bill where status='paid' or status ='Credit' and companyName ='" + compName + "'"
Dim myCmd As New SqlCommand(mySelectQuery, myConnection)
'myConnection.Open()
' daMyName.SelectCommand = myCmd
answer = myCmd.ExecuteScalar()
myConnection.Close()
MessageBox.Show(answer)
an1 = Convert.ToString(answer)
MessageBox.Show(an1)
If myConnection.State = ConnectionState.Closed Then myConnection.Open()
Try
'for val2
Dim mySelQuery As String = "Select SUM (total) FROM tbl_bill where status='unpaid' or status='partial paid' and companyName ='" + compName + "'"
Dim myCmmd As New SqlCommand(mySelQuery, myConnection)
'myConnection.Open()
' daMyName.SelectCommand = myCmmd
answer1 = myCmmd.ExecuteScalar()
myConnection.Close()
MessageBox.Show(answer)
an2 = Convert.ToString(answer1)
MessageBox.Show(an2)
Catch ex As InvalidCastException
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
'If answer1 = 1 Then
' answer1 = 0
'Else
' answer1 = answer1
'End If
' MessageBox.Show(answer1)
If myConnection.State = ConnectionState.Closed Then myConnection.Open()
Try
'status='unpaid' or status='partial paid' and
MyCommand.Connection = myConnection
MyCommand.CommandText = "SELECT * FROM tbl_customer where companyName ='" + compName + "'"
MyCommand.CommandType = CommandType.Text
adp1.SelectCommand = MyCommand
adp1.Fill(ds1, "Customers")
orpt.SetDataSource(ds1.Tables("Customers")) 'datasource1
' CrystalReportViewer1.ReportSource = rpt
Catch Excep As InvalidCastException
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
myConnection.Close()
pfield.Name = "val1"
pdiscrete.Value = an1
pfield.CurrentValues.Add(pdiscrete)
pfields.Add(pfield)
pfield1.Name = "val2"
pdiscrete1.Value = an2
pfield1.CurrentValues.Add(pdiscrete1)
pfields.Add(pfield1)
Dim totalAnswer As Double
totalAnswer = answer - answer1
MessageBox.Show(totalAnswer)
an3 = Convert.ToString(totalAnswer)
MessageBox.Show(an3)
' MessageBox.Show(totalAnswer)
pfield2.Name = "val3"
pdiscrete2.Value = an3
pfield2.CurrentValues.Add(pdiscrete2)
pfields.Add(pfield2)
'orpt.SetDataSource = ds1.Tables(1)
orpt.Subreports("rptStatementUnpaidPart.rpt").SetDataSource(myDS.Tables(1))
orpt.Subreports("rptStatementPaidPart.rpt").SetDataSource(ds.Tables(1))
CrystalReportViewer1.EnableDrillDown = False
CrystalReportViewer1.ParameterFieldInfo = pfields
CrystalReportViewer1.ReportSource = orpt
End Sub
Private Sub CrystalReportViewer1_HandleException(source As Object, e As ExceptionEventArgs) Handles CrystalReportViewer1.HandleException
End Sub
End Class