开发者

how to connect SQL and R.Net?

I want to connect SQL database from R.Net. I am using R.Net from vb.net.

Is it possible? If it possible how?

Using vb.net i have added some .DLL file (R.Net.dll,RdotNET.dll) which will help to work R.Net and i did some coding to find sum.

code:

Imports RdotNET

Public Class Form1

    Dim engine As REngine
    Dim sum As Double

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)   Handles MyBase.Load

        REngine.SetDllDirectory("@C:\Program Files\R\R-2.12.0\bin\i386")
        engine = REngine.CreateInstance("RDotNet")
        engine.EagerEvaluate("sum<- 5 + 6")
        s开发者_如何转开发um = engine.GetSymbol("sum").AsNumeric.First()
        MessageBox.Show(sum.ToString)

    End Sub

now i need to connect to Sql. i need to read a table data and display it in a my app

sorry for my bad English.


Writing R code that uses R.NET to call a .NET connection to a SQL database seems like an overcomplicated way of doing things. Unless your use case demands this (edit your question to explain what you are doing), I recommend using one of the many R packages that connect directly to SQL databases. Take a look at dbConnect, RMySQL, RPostgreSQL, RODBC, RSQLite or RpgSQL, depending upon what sort of database it is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜