PC Review


Reply
Thread Tools Rate Thread

ADO.Net with Oracle error for specific table name

 
 
jzhao
Guest
Posts: n/a
 
      25th Aug 2003
I have a table tbl_Users with UserID as primary key.
Update code like this:

Dim strSQL As String
Dim intCnt As Integer

Dim con As OleDbConnection
Dim oDTAdapter As OleDbDataAdapter
Dim drRow As DataRow
Dim dtUsers As New DataTable()

Try
con = New OleDbConnection
("Provider=MSDAORA.1;Password=*;User ID=*;Data
Source=*;Persist Security Info=True")
strSQL = "SELECT * FROM tbl_Users"

con.Open()

Try

oDTAdapter = New OleDbDataAdapter(strSQL,
con)
oDTAdapter.Fill(dtUsers)
intCnt = dtUsers.Rows.Count

Dim oCB As OleDbCommandBuilder = New
OleDbCommandBuilder(oDTAdapter)

'--Create primary key
Dim pk(0) As DataColumn
pk(0) = dtUsers.Columns("UserID")
dtUsers.PrimaryKey = pk

drRow = dtUsers.Rows(0)

drRow("usrReserved") = DBNull.Value

oDTAdapter.Update(dtUsers)

Finally
con.Close()
End Try

Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
End Try

There will be exception created in Update line:
Dynamic SQL generation for the UpdateCommand is not
supported against a SelectCommand that does not return any
key column information.

Now do this: just change table name from tbl_Users to
tbl_Usrs, there will be no exceptions at all!

There are also other strange things going on with ADO.Net
to Oracle. ADO.Net doesn't like oracle data type like
number(18,6) when the number is very small (like .00006).
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle Table Adapter Querry Wizard Error Ryan M. Hager Microsoft ADO .NET 8 14th Jun 2006 05:03 AM
Oracle Table Adapter Querry Wizard Error =?Utf-8?B?UnlhbiBNIEhhZ2Vy?= Microsoft ADO .NET 0 20th Mar 2006 10:56 PM
Error linking Oracle table in Access 2003 =?Utf-8?B?YWxhbg==?= Microsoft Access 0 7th Sep 2005 02:14 AM
DbDataAdapter error when update oracle table =?Utf-8?B?TmFwbw==?= Microsoft ADO .NET 0 17th May 2005 01:09 PM
DataAdapter wizard and Oracle table - error =?Utf-8?B?SnVsaWFu?= Microsoft ADO .NET 1 3rd Feb 2004 03:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:19 PM.