oracle表中没有保存的值为什么? [英] the value not saved in oracle table why?

查看:78
本文介绍了oracle表中没有保存的值为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 Imports System.Data 
Imports System.Data.Odbc
Imports System.Data.Odbc.OdbcDataReader
Partial Class _STUDENTTABLE
Inherits System .Web.UI.Page
Dim CON As OdbcConnection
Dim comm As OdbcCommand
Dim instance As OdbcDataAdapter
Dim a As Integer
Protected Sub Page_Load(ByVal sender As < span class =code-sdkkeyword> Object ,ByVal e As System.EventArgs)Handles Me.Load

End Sub

受保护的子BTNINSERT_Click(ByVal发送者)作为 Object ,ByVal e As System.EventArgs)处理BTNINSERT.Click
CON = New OdbcConnection( DSN = DBLOG; Driver =(XE中的Oracle); UID = system; PWD = SYS; SERVER = localhost;
CON.Open( )
MsgBox( 已成功打开
comm = New OdbcCommand(< span class =cod电子字符串> INSERTSTUDENT,CON)
comm.CommandType = CommandType.StoredProcedure
comm.Parameters.AddWithValue( ID _,TXTID.Text)
comm.Parameters.AddWithValue( STUDENTNAME _,TXTNAME.Text)
comm.Parameters.AddWithValue( DEPARTMENT _,TXTDEPART.Text)
comm.Parameters.AddWithValue( YEAR _,TXTYEAR.Text)
comm = New OdbcCommand( {call INSERTSTUDENT(?,?,?,?)},CON)
CON.Close()
MsgBox( 已成功关闭
End Sub

解决方案
1。重复的帖子是不好的行为!

2.您不在代码中的任何位置执行命令。如果不调用comm.ExecuteNonQuery(),就不会发生任何事情。关闭连接根本不会导致执行命令。

3.您有两个用于设置相同命令对象的标记:第一个看起来没问题,第二个看起来不对。

4.您希望MesageBox在哪里显示? IIS无法执行此操作!


Imports System.Data
Imports System.Data.Odbc
Imports System.Data.Odbc.OdbcDataReader
Partial Class _STUDENTTABLE
    Inherits System.Web.UI.Page
    Dim CON As OdbcConnection
    Dim comm As OdbcCommand
    Dim instance As OdbcDataAdapter
    Dim a As Integer
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub BTNINSERT_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTNINSERT.Click
        CON = New OdbcConnection("DSN=DBLOG;Driver=(Oracle in XE);UID=system;PWD=SYS;SERVER=localhost;")
        CON.Open()
        MsgBox("successfully opened")
        comm = New OdbcCommand("INSERTSTUDENT", CON)
        comm.CommandType = CommandType.StoredProcedure
        comm.Parameters.AddWithValue("ID_", TXTID.Text)
        comm.Parameters.AddWithValue("STUDENTNAME_", TXTNAME.Text)
        comm.Parameters.AddWithValue("DEPARTMENT_", TXTDEPART.Text)
        comm.Parameters.AddWithValue("YEAR_", TXTYEAR.Text)
        comm = New OdbcCommand("{call INSERTSTUDENT(?, ?, ?, ?)}", CON)
        CON.Close()
        MsgBox("successfully closed")
    End Sub

解决方案

1. Duplicate posts are bad behavior!
2. You do not execute the command anywhere in your code. Without calling comm.ExecuteNonQuery(), nothing will happen. Closing a connection does not at all cause a command to be executed.
3. You have two staements for setting the same command object: The first one looks OK, the second one looks wrong.
4. Where do you expect the MesageBox to be shown? The IIS cannot do so!


这篇关于oracle表中没有保存的值为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆