on 07-20-2017 6:16 PM
Greetings Colleagues,
I am trying to build C# based app for HANA but i end up with errors thats un predictable.
so i added references for both the .net dlls.
now it dosent work and the code complains about the runtime.
App.config
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> </startup>
<connectionStrings> <add name="Hana" connectionString="Server=localhost:30015;UserName=SYSTEM;Password=******" providerName="Sap.Data.Hana" /> </connectionStrings> </configuration>
FORM1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq; using System.Text; using System.Threading.Tasks;
using System.Windows.Forms; using Sap.Data.Hana; namespace WindowsFormsApp2
{ public partial class Form1 : Form
{
HanaConnection conn; const string SCHEMA = "ASHLIN_PLAYAREA";
const string PRODUCTS_TABLE = "T_POLY_RESULT_JOIN";
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
conn = new HanaConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Hana"].ConnectionString);
conn.Open();
HanaDataAdapter dataAdapter = new HanaDataAdapter("SELECT ID,EQUIPMENT FROM " + SCHEMA + "." + PRODUCTS_TABLE, conn);
DataTable testTable = new DataTable();
dataAdapter.Fill(testTable);
dataGridView1.DataSource = testTable;
//Format the grid (optional)
dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { }
} }
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Please tell me what is wrong with this code...
Br,
Gabriels.
Error Description.
SeverityCodeDescriptionProjectFileLineSuppression State ErrorCS0433The type 'HanaConnection' exists in both 'Sap.Data.Hana.v3.5, Version=1.0.9.0, Culture=neutral, PublicKeyToken=***********' and 'Sap.Data.Hana.v4.5, Version=1.0.9.0, Culture=neutral, PublicKeyToken=0*********'WindowsFormsApp2C:\Users\scarl\Documents\Visual Studio 2017\Projects\WindowsFormsApp2\WindowsFormsApp2\Form1.cs16Active
i tried to resolve it myself but not really helped.
This is not a HANA issue.
Please re-direct this to an area which deals with BI Software Developement or open an incident with SAP under the component BI-DEV-NET
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.