using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
public partial class Query : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = "";
} protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text =="")
{
//MessageBox.Show("請輸入P001!", "操作提示");
Label3.Text = "請輸入P001!";
}
string constring = "Server=192.168.2.81;Data Source=BRISA;Persist Security Info=True;User ID=roebrisa;Password=roemanager;Unicode=True";
OracleConnection conn = new OracleConnection(constring);
conn.Open(); string sqlstring = "select MR_NO from r_wip_panel where SHIPPING_PALLET_NO='" + TextBox1.Text.ToString().Trim() + "' ";
OracleCommand cmd = new OracleCommand(sqlstring, conn); try
{
string result = cmd.ExecuteOracleScalar().ToString().Trim();
TextBox2.Text = result; } catch
{
} finally
{
conn.Close();
}
}
}編譯器錯誤訊息: CS0234: The type or namespace name 'OracleClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
public partial class Query : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = "";
} protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text =="")
{
//MessageBox.Show("請輸入P001!", "操作提示");
Label3.Text = "請輸入P001!";
}
string constring = "Server=192.168.2.81;Data Source=BRISA;Persist Security Info=True;User ID=roebrisa;Password=roemanager;Unicode=True";
OracleConnection conn = new OracleConnection(constring);
conn.Open(); string sqlstring = "select MR_NO from r_wip_panel where SHIPPING_PALLET_NO='" + TextBox1.Text.ToString().Trim() + "' ";
OracleCommand cmd = new OracleCommand(sqlstring, conn); try
{
string result = cmd.ExecuteOracleScalar().ToString().Trim();
TextBox2.Text = result; } catch
{
} finally
{
conn.Close();
}
}
}編譯器錯誤訊息: CS0234: The type or namespace name 'OracleClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OracleClient;写成这样了还不对。
string constring = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.81)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)));User Id=roebrisa;Password=roemanager;";
然后再在代码中using
using System.Data;
using System.Data.OracleClient;
右键-解析-添加引用using....
右键项目或bin文件夹,添加引用,找到System.Data.OracleClient
添加上即可啊
編譯器錯誤訊息: CS0234: The type or namespace name 'OracleClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)