Al grafico 3D, non avendo ricevuto risposte ne qui ne su altri forum, ci ho rinunciato, però ho un'altro problemino...
Nello stesso Chart vorrei 2 elementi...
codice:
Private Sub Grafico2(ByVal Mese As String, ByVal Anno As String)
cnn = New OleDb.OleDbConnection
cnn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source = " & Application.StartupPath & "\gestionale.mdb"
If Not cnn.State Then
cnn.Open()
End If
Dim ChartArea1 As ChartArea = New ChartArea()
Dim Legend1 As Legend = New Legend()
Dim Entrate As Series = New Series()
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
sql2 = "SELECT Data, Importo FROM entrate "
If Mese <> "--Tutti--" And Anno <> "--Tutti--" Then
sql2 = sql2 & "WHERE month(Data)=" & Mese & " and Year(Data) = " & Anno
ElseIf Mese <> "--Tutti--" And Anno = "--Tutti--" Then
sql2 = sql2 & "WHERE month(Data)=" & Mese
ElseIf Mese = "--Tutti--" And Anno <> "--Tutti--" Then
sql2 = sql2 & "WHERE Year(Data) = " & Anno
End If
sql2 = sql2 & " Order By ID ASC"
Dim da As New OleDbDataAdapter(sql2, cnn)
da.Fill(ds, "entrate")
Entrate.Name = "Entrate"
Chart2.Legends("Legend1").BackColor = Color.Transparent
Chart2.Series("Entrate").IsValueShownAsLabel = True
Chart2.Series("Entrate").XValueMember = "Data"
Chart2.Series("Entrate").YValueMembers = "Importo"
Chart2.DataSource = ds.Tables("entrate")
cnn.Close()
If Not cnn.State Then
cnn.Open()
End If
Dim Uscite As Series = New Series()
Dim dt1 As New DataTable
Dim ds1 As New DataSet
ds1.Tables.Add(dt1)
sql3 = "SELECT Data, Importo FROM uscite "
If Mese <> "--Tutti--" And Anno <> "--Tutti--" Then
sql3 = sql3 & "WHERE month(Data)=" & Mese & " and Year(Data) = " & Anno
ElseIf Mese <> "--Tutti--" And Anno = "--Tutti--" Then
sql3 = sql3 & "WHERE month(Data)=" & Mese
ElseIf Mese = "--Tutti--" And Anno <> "--Tutti--" Then
sql3 = sql3 & "WHERE Year(Data) = " & Anno
End If
sql3 = sql3 & " Order By ID ASC"
Dim da1 As New OleDbDataAdapter(sql3, cnn)
da1.Fill(ds1, "uscite")
Uscite.Name = "Uscite"
Chart2.Series("Uscite").IsValueShownAsLabel = True
Chart2.Series("Uscite").XValueMember = "Data"
Chart2.Series("Uscite").YValueMembers = "Importo"
Chart2.DataSource = ds1.Tables("uscite")
cnn.Close()
End Sub
Il mio errore è qui...
codice:
Chart2.DataSource = ds.Tables("entrate")
.
.
.
.
.
.
.
.
.
Chart2.DataSource = ds1.Tables("uscite")
Come risolvo?