从数据库中提取特定单元格计算,网络矩阵

发布于 2024-12-10 09:00:42 字数 767 浏览 0 评论 0原文

我目前正在与 Webmatrix 合作,尝试设计一个网络应用程序。我正在尝试创建一个网站,允许用户使用图表分析数据库中的数据。我创建了一个数据库,我想从中提取特定单元格内的 int 值并将其与另一个单元格相乘,然后绘制输出图,就像 Excel 工作表一样。事实上,我有一个 Excel 工作表,我基本上想将其变成一个交互式网络应用程序。

我在尝试绘制结果图表时遇到了问题。下面是我尝试过的代码。

@{

var db = Database.Open("myDatabase") ;
var sql = "SELECT myFirstColumn FROM myDatabase WHERE Id = 5";
var fifth = db.QueryValue(sql);
sql = "SELECT mySecondColumn FROM myDatabase WHERE Id = 6";
var sixth = db.QueryValue(sql);
var calculation = sixth * fifth;
var grid = new WebGrid(calculation);

}

另外,我尝试通过创建 var Chart,然后使用 write() 函数来省略 WebGrid()。这也失败了。我正在 .cshtml 页面中创建所有这些。非常感谢任何帮助。

如果有人觉得我使用 Webmatrix 创建此类 Web 应用程序走上了错误的道路,请告诉我并告诉我哪种语言/平台最好。如果需要,我愿意学习新的平台和/或语言。我不想浪费太多时间才意识到自己走错了路。再次感谢!

I am currently working with Webmatrix, attempting to design a web app. I am trying to create a site that allows users to analyze data from a database using graphs. I have created a database from which I would like to extract the int value from within a particular cell and multiply it with another, then graph the output, much like an Excel sheet does. In fact, I have an excel sheet that I am basically trying to turn into an interactive web app.

I am running into an issue when trying to graph the result. Below is code that I have tried.

@{

var db = Database.Open("myDatabase") ;
var sql = "SELECT myFirstColumn FROM myDatabase WHERE Id = 5";
var fifth = db.QueryValue(sql);
sql = "SELECT mySecondColumn FROM myDatabase WHERE Id = 6";
var sixth = db.QueryValue(sql);
var calculation = sixth * fifth;
var grid = new WebGrid(calculation);

}

Also, I have tried to leave out the WebGrid() by creating a var Chart, then using the write() function. This has also failed. I am creating all of this within a .cshtml page. Any help is greatly appreciated.

If anyone feels that I am taking the wrong route by using Webmatrix to create this sort of web app, please let me know and tell me what language/platform would be best. I am open to learning a new platform and/or language if needed. I don't want to waste too much time before realizing I'm taking the wrong route. Thanks again!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨轻弹 2024-12-17 09:00:42

您应该能够使用以下代码来执行此操作:

    var myChart = new Chart(width: 600, height: 400)
        .AddTitle("My Chart"
        .AddSeries(
            name: "Calculations",
            xValue: new[] {  fifth },
            yValues: new[] { calculation })
        .Write();

您提到的失败的图表代码做了什么?

You should be able to do this with the following code:

    var myChart = new Chart(width: 600, height: 400)
        .AddTitle("My Chart"
        .AddSeries(
            name: "Calculations",
            xValue: new[] {  fifth },
            yValues: new[] { calculation })
        .Write();

What did the chart code you referred to as failing do?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文