I had assumed that your "datum" field was a string type; is is a DateTime
type? If so, then this can be simplified a bit:
@using System.Data;
@using System.Collections.Generic;
@using System.Data.SqlClient;
@{
Layout = null;
string connectionString="Server=xxx.xxx.xxx.xxx,1433\\sqlexpress;
Database=HEK; Uid=sa; Pwd=xxxxxxxxxxxxx";
DataTable dt = new DataTable();
String rows = new String();
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
using (SqlDataAdapter adapter = new SqlDataAdapter("SELECT Datum, Sava,
RPWS1 FROM vws", conn))
{
adapter.Fill(dt);
List<string> rowsList = new List<string>();
foreach (DataRow row in dt.Rows)
{
rowsList.Add("[new Date(" + row["Datum"].Year + ", " + (row["Datum"].Month
- 1) + ", " + row["Datum"].Day + ", " + row["Datum"].Hour + ", " +
row["Datum"].Minute + ", " + row["Datum"].Second + "), " + row["Sava"] + ",
" + row["RPWS1"] + "]");
}
rows = String.Join(", ", rowsList);
};
};
}
<script type='text/javascript' src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
function drawChart() {
var data1 = google.visualization.DataTable()
data1.addColumn('datetime', 'Datum');
data1.addColumn('number', 'Savum');
data1.addColumm('number', 'RPWS1');
data1.addRows([@Html.Raw(rows)]);
var chart = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data1, {
height: 350,
width: 900,
title: 'Absolutna kota vode v tesnilni zavesi',
vAxis: {
maxValue: 165.5,
minValue: 159,
title: 'absolutna kota'
}
});
}
On Saturday, February 23, 2013 1:45:43 PM UTC-5, Matevz Uros Pavlic wrote:
>
> Hi,
> here is the problem :
> datetimeList = new List<string>(row["Datum"].Split(" "));
>
> 'object' does not contain a definition for 'Split' and no extension method
> 'Split' accepting a first argument of type 'object' could be found (are you
> missing a using directive or an assembly reference?)
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.