爱问知识人 爱问教育 医院库

有关C#用CS做登陆程序的问题?

首页

有关C#用CS做登陆程序的问题?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
namespace Login
{
    public partial class Formlogin : Form
    {
        public Formlogin(Login.Form1 parent)
        {
            InitializeComponent();
            this.MdiParent = parent;
        }
        private void buttonlogin_Click(object sender, EventArgs e)
        {
            if ((textBoxUser.Text == "mytest1") && (textBoxPwd.Text == "mytest1"))
            {
                string ConnectionString = "Data Source=ORCL;user=" + textBoxUser.Text + ";password=" + textBoxPwd.Text;
                using (OracleConnection conn = new OracleConnection(ConnectionString))
                {
                    try
                    {
                        conn.Open();
                        int val = OracleHelper.ExecuteNonQuery("insert into TBL_USERINFO(ID,LOGINNAME,PWD,NAME,BIRTHDAY) values(1,001,123,33333,111);");/////////////////////////此处有错误?求助高手
                    }
                    catch (OracleException ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    finally
                    {
                        conn.Close();
                    }
                }
                Console.WriteLine("登陆成功");
            }
            else
            {
                Console.WriteLine("登陆失败!");
            }
        }
    
       }
        }
引用OracleHelper中的函数
 public static int ExecuteNonQuery(string cmdText)
        {
            OracleCommand cmd = new OracleCommand();
            using (OracleConnection connection = new OracleConnection(connectionString))
            {
                PrepareCommand(cmd, connection, null, CommandType.Text, cmdText, null);
                int val = cmd.ExecuteNonQuery();
                cmd.Parameters.Clear();
                return val;
            }
        }

提交回答
好评回答
  • 2013-01-04 07:14:29
    insert into TBL_USERINFO(ID,LOGINNAME,PWD,NAME,BIRTHDAY) values(1,001,123,33333,111);
    我猜想你的LOGINNAME,PWD,NAME应该是varchar类型,BIRTHDAY可能是varchar或者timestamp类型
    插入数据时,应该是:values(1,'001','123','33333',111)"
    如果BIRTHDAY是日期时间类的类型,还要进行转换,使用to_data之类的sql函数

    好***

    2013-01-04 07:14:29

  • C#/.NET 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):