|
I have hit a wall with my application. I am having problems when dealing with a LONG column in the database. I am getting errors when using the data adapters for either ODBC or OLE (tried both) when the value in one of the LONG columns reaches over a certain threshold length. I try to use the FILL command to get the data from the data provider and into a DataSet or DataTable to then display in a window for the user. However, this causes an error as I mentioned. So I have spent too much time digging and trying to get past this but cannot find a solution.
Do I need to create my own override for the FILL command so it handles LONG columns? I would have expected this to be already handled by MS Framework - perhaps not!?
Anyone have time to help me? I would REALLY appreciate it!
I am trying to access a SQL Anywhere database file (dbf) and provide a fully functional database explorer to the users so we can perform various tasks easier.
Here is my ODBC test code that fails at the FILL line...
Dim conn As New Odbc.OdbcConnection("DSN=" & "client_x" & ";UID=" & "STT" & ";PWD=" & "NEED2CHANGE" & ";")
Dim dr As Odbc.OdbcDataReader
Dim strSQL As String = "select b.name, b.row_id, b.inactive_flg, b.script from SIEBEL.S_APPL_WEBSCRPT b where b.row_id = '1-K3E-1IYQ'"
Dim dt As New DataTable
Dim dg As New DataGrid
Dim cmd As New Odbc.OdbcCommand(strSQL, conn)
Dim vals() As String
Dim myAdaptor As New Odbc.OdbcDataAdapter(strSQL, conn)
myAdaptor.AcceptChangesDuringFill = True
myAdaptor.Fill(dt)
Here is my OLE test code that works when I query only for 1 record, but when multiple records are returned I cannot get the FILL command to work at all!
Dim ConnString As String
Dim Connect As ADODB.Connection
Dim RS As New ADODB.Recordset
Dim DataGrid1 As New DataGridEX
Dim dt As New DataTable
Dim ds As New DataSet
Dim custDA As New OleDb.OleDbDataAdapter
Dim strSQL As String = "select b.name, b.row_id, b.inactive_flg, b.script from SIEBEL.S_APPL_WEBSCRPT b"
ConnString = "DSN=" & "client_x" & ";UID=" & "SST" & ";PWD=" & "NEED2CHANGE" & ";"
Connect = New ADODB.Connection
Connect.CursorLocation = ADODB.CursorLocationEnum.adUseServer
Connect.Open(ConnString)
RS.CacheSize = 10
RS.Open(strSQL, Connect, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText)
custDA.Fill(dt, RS)
Dim f As New Form
Dim t As New TextBox
t.Multiline = True
f.Controls.Add(t)
t.Dock = DockStyle.Fill
t.Text = RS.Fields(3).GetChunk(RS.Fields(3).ActualSize)
Thanks!
John Wadleigh
Siebel Expert
|
|
|
|
|
I think that a LONG column in the database cannot fit inside the limits of the mapped column under ODBC or OLE. It's possible that the column would have to be treated like a binary object column, such as an image, where you have to get the contents of the column using a stream process. That's why I said using the database-specific provider would provide better compatibility.
|
|
|
|
|
how to edit appconfig in windows application(C#)??
i am using this code but not getting success please help me
Code:-
Properties.Settings.Default.DestinationDrives = "ppc";
Properties.Settings.Default.Save();
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Why post C# questions here? (As well as the proper forum)
Bob
Ashfield Consultants Ltd
|
|
|
|
|
if u know the answer then help me.
thanks
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Too late - you have been given the answer in the correct forum. It is a pain when people post the same question to multiple forums, and even more so when it is OBVIOUSLY the wrong forum.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Use common sense and don't cross post.
|
|
|
|
|
kissdznuts wrote: Use common sense
I ditto that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
...
Blog link to be reinstated at a later date.
|
|
|
|
|
I have to develop an server/client application like this:
-database on server
-clients connecting to server, working with that database(as many i want)
I never did something like that so any help will be appreciated, especially some code examples.
I am using vb 2008 professional edition
|
|
|
|
|
AngSoft wrote: I never did something like that
What have you done in vb.net ?
If this is an actual paying job for a customer, I warmly suggest one of the following solutions:
1. Call it off
2. Hire a programmer with the necessary experience to do it for you
3. Take the customer's money, and buy a plane ticket to a country that does not have an extradition agreement with yours.
Otherwise you are going to have to be much more specific.
AngSoft wrote: any help will be appreciated
Help with what exactly ?
AngSoft wrote: especially some code examples
Code examples of what exactly ?
Visual Studio contains help files, which contain plenty of walkthroughs and examples that can help you on your way with database - client application development.
Good luck with it.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Try here
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi All,
I am developing an Application in vb.net 2008
In my application I am using an Thread named 'ThreadSplace', that runs the Splash Screen at the start of the Project and when the MDI is Loaded the Thread is Aborted.
But the Problem is that when the the application run from my exe, at the time of Loading MDI it throws an error :
"Unhandled exception has occurred in Your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, The application will close immediately.
Thread was being abored."
But, I am never understand from where this error throws. Because when I run my application from my Project It works fine.
Please Help me.
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
If you manually stop a thread using the Abort() method, this throws a ThreadAbortException. I guess the exception it thrown where you stop the splash window thread.
|
|
|
|
|
I put Try..Catch block in the places where I am call thread.abort()
But this exception throws where no thry catch block.
I guess when I am intialize the thread at the start of the mdi form such as :
Public Class frmMDIMain
Public TimerShowSplash As New Threading.Thread(AddressOf frmMDIMain.LoadPlashScreen)
Private Sub frmMDIMain_FormClosing(ByVal sender As Object, ByVal e As ..................
may be some how when the MDI form call again then it will hit on Timersplash intialise line. and then the error throws.
So, What will be the solution
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
Calling Abort is not safe. It generates ThreadAbortException and it is not guaranteed that the thread will stop working. See what MSDN says about this exception
MSDN
When a call is made to the Abort method to destroy a thread, the common language runtime throws a ThreadAbortException. ThreadAbortException is a special exception that can be caught, but it will automatically be raised again at the end of the catch block.
This is the reason why your code is crashing. You should consider some safe methods for aborting your thread. Use a volatile boolean variable and if is set, exit from the thread manually.
|
|
|
|
|
How can I Abort a thread or exit from a tread without Threading.thread.exception
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
You can use a flag variable inside the thread code and check it periodically to see if the code should exit.
|
|
|
|
|
Did you see the VS2008 comes with a SplashScreen component?? If you have the application framework enabled in your project, you can add it just like you added a new form. You can even modify the splash screen form however you like.
Just a thought...
|
|
|
|
|
Hi all,
I have one web methode in my web service,that can only get one table from my application and it is without Transaction,
<WebMethod()> _
Public Function OprationONTbl(ByRef ds As Data.DataSet, ByVal TblName As String, ByVal Insert As Boolean, ByVal Update As Boolean, ByVal StrWhere As String, ByVal retValue As Boolean, ByRef StrRetValue As String) As String
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Dim da As New SqlDataAdapter
Dim cBuilder As New SqlCommandBuilder(da)
Try
'-*-> cn
Dim cls As New clsGeneral
cn.ConnectionString = cls.GetConnection
cls = Nothing
'-*-> cmd
cmd.CommandText = "Select * From " & TblName
If StrWhere.Trim <> "" Then cmd.CommandText = cmd.CommandText & " WHERE " & StrWhere
cmd.Connection = cn
'-*-> da
da.SelectCommand = cmd
'**************************************'
If Not Insert And Not Update Then
da.Fill(ds, TblName)
End If
'**************************************'
If Insert Then
da.InsertCommand = cBuilder.GetInsertCommand
da.Update(ds.Tables(TblName))
If retValue Then
cmd.CommandText = "Select Max(Id) from " & TblName
cn.Open()
StrRetValue = cmd.ExecuteScalar
cn.Close()
End If
End If
'**************************************'
If Update Then
Dim value() As String = StrWhere.Split("*")
cmd.CommandText = "UpDate " & TblName & " SET " & value(1) & " WHERE " & value(0)
cn.Open()
cmd.ExecuteNonQuery()
cn.Close()
End If
Return ""
Catch ex As Exception
Return "OprationONTbl : " & ex.Message
Finally
If cn.State = ConnectionState.Open Then cn.Close()
cn = Nothing
cmd = Nothing
da = Nothing
cBuilder = Nothing
End Try
End Function
Now i want get more table form my application and with transaction, that if i send to webService two tables, with one transaction tow tables be full of data,
now i changed above web method but my result is not true ,i test to many state of this code but it has different Error for Inserting data,
I don't know how i can change this web method for doing my work true.
i write this but it is mistake,
Dim myTblName() As String = TblName.Split("$")
'-*-> cmd
For i As Integer = 0 To myTblName.Length - 1
cmd.CommandText = "Select * From " & myTblName(i)
If StrWhere.Trim <> "" Then cmd.CommandText = cmd.CommandText & " WHERE " & StrWhere
cmd.Connection = cn
'-*-> da
da.SelectCommand = cmd
'**************************************'
If Not Insert And Not Update Then
da.Fill(ds, myTblName(i))
End If
Next
'**************************************'
If Insert Then
Dim trans As SqlTransaction
cn.Open()
trans = cn.BeginTransaction
cmd.Transaction = trans
For i As Integer = 0 To myTblName.Length - 1
da.InsertCommand = cBuilder.GetInsertCommand
da.Update(ds.Tables(myTblName(i)))
If retValue Then
cmd.CommandText = "Select Max(Id) from " & myTblName(i)
StrRetValue = cmd.ExecuteScalar
End If
Next
Try
trans.Commit()
Catch ex As Exception
trans.Rollback()
End Try
End If
'**************************************'
If Update Then
cn.Open()
Dim trans As SqlTransaction
trans = cn.BeginTransaction
cmd.Transaction = trans
For i As Integer = 0 To myTblName.Length - 1
Dim value() As String = StrWhere.Split("*")
cmd.CommandText = "UpDate " & myTblName(i) & " SET " & value(1) & " WHERE " & value(0)
cmd.ExecuteNonQuery()
Next
Try
trans.Commit()
Catch ex As Exception
trans.Rollback()
End Try
End If
Return ""
Catch ex As Exception
Return "OprationONTbl : " & ex.Message
Finally
If cn.State = ConnectionState.Open Then cn.Close()
cn = Nothing
cmd = Nothing
da = Nothing
cBuilder = Nothing
End Try
End Function
i need your help,
Thank You
<div class="ForumSig">Hoda </div>
|
|
|
|
|
Don't use Max(Id) and a transaction to get the id, just call "select scope_identity()" after you have made the insert. That is the normal method to get the id, and it will use less resources on the server.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
How will I remove a textbox during runtime by using linklabel in c# language.
|
|
|
|
|
what do you want to do actually
if you want to remove textbox on click of link label then use following
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked<br />
Me.Controls.Remove(TextBox1)<br />
End Sub
and if you want to off the visiblity of the textbox then do following
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
TextBox1.Visible=False
End Sub
hope this helps
|
|
|
|
|
hitesh.kalra wrote: How will I remove a textbox during runtime by using linklabel in c# language.
And you're asking that in a VB forum?
|
|
|
|
|
when i run my application in debug mode it gives me the following error at startup , i am unable to resolve this issue , please help , thanks in advance .....
An error occurred creating the form. See Exception.InnerException for details. The error is: The type initializer for 'Request_Forms.Main' threw an exception.
hello
|
|
|
|