PLATINUM_II 2017-03-29 10:56 采纳率: 100%
浏览 1417
已采纳

ORA-12514:是什么意思

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OracleClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyWinForm5

{

public partial class Form1 : Form
{

    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        dataGridView1.Visible = false;
        UserID.TabIndex = 0;
        PWD.TabIndex = 1;
        PWDFRIM.TabIndex = 2;
        Man.TabIndex = 3;
        Women.TabIndex = 4;
        vacation.TabIndex = 5;
        Add.TabIndex = 6;
        Exit.TabIndex = 7;
        Delete.Visible = false;
        Save.Visible = false;

    }
    /// <summary>
    /// 隐藏注册界面,显示表数据
    /// </summary>
    #region
    public void HideAdd()
    {
        dataGridView1.Visible = true;
        UserID.Visible = false;
        UserName.Visible = false;
        PassWord.Visible = false;
        PWD.Visible = false;
        PWDFRIM.Visible = false;
        PasswordFirm.Visible = false;
        Sex.Visible = false;
        Man.Visible = false;
        Women.Visible = false;
        Job.Visible = false;
        vacation.Visible = false;
        Add.Visible = false;
        Exit.Visible = false;
        Save.Visible = true;
        Delete.Visible = true;
    }
    #endregion  
    /// <summary>·
    /// 显示注册界面,隐藏表数据
    /// </summary>
    #region
    public void ShowAll()
    {
        Save.Visible = false;
        Delete.Visible = false;
        dataGridView1.Visible = false;
        UserID.Visible = true;
        UserName.Visible = true;
        PassWord.Visible = true;
        PWD.Visible = true;
        PWDFRIM.Visible = true;
        PasswordFirm.Visible = true;
        Sex.Visible = true;
        Man.Visible = true;
        Women.Visible = true;
        Job.Visible = true;
        vacation.Visible = true;
        Add.Visible = true;
        Exit.Visible = true;
    }
    #endregion     
    private void Add_Click_1(object sender, EventArgs e)
    {
        ShowAll();
        int sex;
        sex = 0;
        if (this.Women.Checked == true)
        {
            sex = 1;
        }
        string ConStr = @"DATA SOURCE=localhost/ORCL;User ID=guohongwei;PASSWORD=123456;PERSIST SECURITY INFO=True;";
        string sql = @"insert into BASEINF(ID,CODE,PWD,GENDER,JOB)  values('" + 1 + "','" + this.UserID.Text.Trim() + "','" + this.PWD.Text.Trim() + "'," + sex + ",'" + this.vacation.Text.Trim() + "')";
        //string sql = @"Insert into BASEINF(ID,PWD,GENDER,JOB) select '" + this.UserID.Text.Trim() + "','" + this.PWD.Text.Trim() + "'," + sex + ",'" + this.vacation.Text.Trim() + "' from BASEINF";
        string sql2 = @"select * from BASEINF";
        if (UserID.Text != null || PWD.Text != null || PWDFRIM.Text!= null || (Man.Checked!=false&&Women.Checked!=false||vacation.Text != null))
        {


                if (PWD.Text.Length < 6)
                {
                    MessageBox.Show("密码长度最少为6位!");
                    PWD.Clear();
                    PWD.Focus();
                    PWDFRIM.Clear();
                }
                else

            if (PWD.Text == PWDFRIM.Text)
            {

                DataTable dt = new DataTable();
                //this.dataGridView1.DataSource = null;
                OracleConnection Conn = new OracleConnection(ConStr);
                Conn.Open();
                OracleCommand cmd = new OracleCommand(sql, Conn);
                int i = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    OracleCommand cmd2 = new OracleCommand(sql2, Conn);
                    OracleDataAdapter adapt = new OracleDataAdapter(cmd2);
                    adapt.Fill(dt);
                    this.dataGridView1.DataSource = dt;
                    MessageBox.Show("注册成功!");
                    HideAdd();


                }
                else
                {
                    MessageBox.Show("注册失败!");
                    UserID.Clear();
                    PWD.Clear();
                    PWDFRIM.Clear();
                    vacation.Clear();

                }
            }
            else
            {
                MessageBox.Show("两次密码不一致!");
                PWDFRIM.Clear();
                PWDFRIM.Focus();
            }
        }
        else
        {
            MessageBox.Show("数据不能为空!");
        }

    }


            错误:
            “System.Data.OracleClient.OracleException”类型的未经处理的异常在 System.Data.OracleClient.dll 中发生   其他信ORA-12514: TNS:listener does not currently know of service requested in connect descripto

            错误是指在Conn.Open上的。
  • 写回答

1条回答 默认 最新

  • threenewbee 2017-03-29 15:29
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西南科技大学数字信号处理
  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥15 pyqt信号槽连接写法
  • ¥500 把面具戴到人脸上,请大家贡献智慧,别用大模型回答,大模型的答案没啥用
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。