VMWare에서 C# 프로젝트가 있고 데이터베이스가 VMWare 외부에 있습니다. 내 실제 PC에 있으며 VMWare는 동일한 PC에 있습니다. 내 질문은 내 PC에서 내 데이터베이스에 어떻게 액세스 할 수 있습니까? 나는이 클래스를 가지고 있지만 작동하지 않는다.VMWare에서 C# 프로젝트이고 데이터베이스가 VMWare 외부에 있습니다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data;
namespace EyeCareCenter
{
class DataBase
{
private string connectionstring = @"Data Source =127.0.0.1,1433 ; Network Library=DBMSSOCN ;Initial Catalog=EyeCareCenter ; Trusted_Connection=True ";
private SqlConnection connection = new SqlConnection();
public void OpenConnection()
{
try
{
connection.ConnectionString = connectionstring ;
connection.Open();
// MessageBox.Show (" Connection successfull ... ");
}
catch (Exception a)
{
MessageBox.Show(a.Message + " ");
}
}
public void CloseConnection()
{
connection.Close();
}
public SqlConnection GetConnection()
{
return connection;
}
}
} 최소한
"작동하지 않는다"는 것은 무엇을 의미합니까? 구체적으로 작동하지 않는 것은 무엇입니까? 의견에 회신하지 마십시오 - 질문을 업데이트하십시오. –
VM이 네트워킹을 허용하도록 구성 되었습니까? 그렇다면 VM에서 호스트 시스템에 액세스 할 수 있습니까? 나는. 이것은 코드가 아닌 VM 구성 문제 일 수 있습니다. – LB2
"외부"머신의 PC IP가 VM의 "내부"에 무엇인지 파악해야합니다. 아마도 DSN에서 사용해야하는 IP가 될 것입니다.> –