[英]C# Oracle connection string for DataGrid
When I import Dataset to application in connnection string I choose "No exclude information from connection string. I will set this information in my aplication". 当我通过连接字符串将数据集导入到应用程序时,我选择“从连接字符串中不排除信息。我将在应用程序中设置此信息”。
Now when I compile the form there is nothing to see in the DataGrid, where I must place connection in my application to connet ? 现在,当我编译表单时,在DataGrid中什么也看不到,我必须在我的应用程序中将连接放置到connet吗?
Now I have: 我现在有:
public Form1()
{
InitializeComponent();
using (OracleConnection con = new OracleConnection("Data Source=localhost;Persist Security Info=True;User ID=martynas;Password=xxxxxxx;Unicode=True"))
{
try
{
con.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = con;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
This conection is open, but DataGridView still does not show any records. 此连接是打开的,但是DataGridView仍然不显示任何记录。 I think that maybe I place connection in wrong method ?
我认为也许我将连接方法错误?
You are not connecting your OracleCommand to anything. 您没有将OracleCommand连接到任何东西。 You create it but when it goes out of scope, it ceases to exists.
您创建了它,但是当它超出范围时,它就不存在了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.