G_Waddell 131 Posting Whiz in Training

Hi,

I'm writing code to connect to Oracle through ODP so I added a reference to the Oracle.DataAccess dll on my machine.

Trouble is I'm writing a 64 bit app and I appear to have both x86 and 64 bit versions of this dll on my machine. No matter which I try, the x86 version seams to get added.

I've even browsed to C:\Windows\assembly\GAC_64\Oracle.DataAccess\2.111.7.20__89b483f429c47342\oracle.dataaccess.dll but I still get issues saying it is a x86 assembly.

How do I lock it down so I'm only referencing the 64 bit one?

G_Waddell 131 Posting Whiz in Training

Hi All,
I think I maybe falling victim to the "double hop"!
We have a windows form program that uses a 3rd party web service to validate bank details (BIC, IBAN etc.)
It uses a class we developed that creates a uri and passes it through the firewall upto the service provider.
We were asked to provide similar functionality on our Intranet so we created a webforms page that points to the same original class. The problem is when the Windows form runs the class, it motors along and returns an answer in seconds, when the ASP.NET page calls the class however, it times out with an error saying it can not connect to the remote server.
I suspected an authentication issue so I wrote new class that inherits from the original class but Impersonates the current user for the web. However, this is still displaying the same behaviour.
Here is my "Web Class" code (with security redactions of course!)

Private Function SendRequest(uri As String, objResponse As String, ByRef theresult As Object) As Boolean
        Dim iUsername As String = "USERXXXX"
        Dim iPassword As String = "XXXXXXXXXXXXXX"
        Dim wrGETURL As WebRequest = Nothing
        Dim cc As System.Net.CredentialCache = Nothing
        Dim theProxy As IWebProxy = Nothing
        Dim wi As WindowsIdentity = Nothing
        Dim CTx As WindowsImpersonationContext = Nothing
        Try
            'Get current User
            wi = System.Web.HttpContext.Current.User.Identity
            'Impersonate the current user... 
            CTx = wi.Impersonate
            ' Connection is established
            wrGETURL = WebRequest.Create(uri)
            theProxy = wrGETURL.Proxy
            If Not IsNothing(theProxy) Then …
G_Waddell 131 Posting Whiz in Training

Hi all,
After drilling through the SQL procedure that was written, it turns out my predecessor was also really bad at writing SQL procedures!!

He seamed to have a pathalogical fear of SQL cursors and not be comfortable with variables either.

A table was being queried (with fields that were not needed,) and the results put into a temp table. Then a select Count statement was run on the temp table to find out the number of rows in the temp table and then a loop was run until the counter went down to zero, each time querying the temp table for the top 1 unprocessed row and then marking it as processed afterwards. During the loop multiple and sometimes unnecessary queries were run to manipulate the data. All to basically port data from one stage in the process to the next.

I rewrote using a cursor and loop with a query that combined several of his queries to bring back only necessary data that were stored in variables. I only needed to run one other query in the loop and perform a single calculation I also added error handling in the form of a Transaction with rollback and commit calls.

I still have instability problems with the entity but I really think I've inherited an awful mess. The really annoying thing is this guy was supposed to be senior to me and on way more money. This was the second of his projects I've looked at and I …

G_Waddell 131 Posting Whiz in Training

Hi all,
Still none the wiser as to what is going on here. The traces I run in SQL Profiler while the code is running don't give me any idea why the error occurs.

I think I'll start to phase out the entity stuff and do it the old fashioned way.. I can code in SQL so I don't need the layer of abstraction.

G_Waddell 131 Posting Whiz in Training

Hi,
I've recently "inherited" a part built project from a developer who as left our company.

He had decided to use Entity Framework but I am finding it to be unstable and slow. I periodically have to reimport objects and stored procedures from the database as the model gets corrupted. I also find database processes to be slower than if I was just running stored procedures and ADO.net

The latest fresh hell it has started to pull is an error New transaction is not allowed because there are other threads running in the session.

I've looked on line and the answer seams to be to do with running updates while reading through data in a loop. Except the code that is throwing the error is not in any loop although it is calling a stored procedure that runs an update.

It could be the Framework or it could be how it has been implemented by my predecessor ( his idea of OOP and N tier left something to be desired,) the issue is it's a big project and I'm not sure the powers that be would be happy if I started again.

So I'm wondering if there is a way to just take the entity part out and build an old fashioned data layer with views and stored procedures... ( and optimised SQL in those proceedures)

G_Waddell 131 Posting Whiz in Training

Hi All,

This issue keeps reocccuring and I can not for the life of me figure out why.

When I add ANY AJAX control to my ASP.Net project, I end up getting an error that a reference in the designer is not defined. For example, if I add an UpdatePanel, the designer will generate something like the following: Protected WithEvents UpdatePanel1 As Global.System.Web.UI.WebControls.UpdatePanel If I change this to Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel the error goes but every time I modify the page, I have to edit all the designer entries for any AJAX control on the page.
I looked at my project references and I have a Reference to System.Web.Extensions. If I open System.Web.Extensions in the Object browser, I can see both System.Web.UI and System.Web.UI.Web and UpdatePanel is under System.Web.UI

I have checked my Toolbox and it is pulling the AJAX controls from the System.Web.UI namespace and not the System.Web.UI.Webcontrols namespace.

Somebody somewhere must have encountered something like this before - why are there the wrong references being generated in the designer?

G_Waddell 131 Posting Whiz in Training

Hi,
You need to give more detail. What methods are you using for the log in (Off the shelf package? your own design?)? How are you storing if the user is logged in or not? Maybe post some code?

For example if you use a session variable to hold if the user is logged in or not, then your log off routine should wipe the variable and every page should check for the variable. If it can't access the variable then redirect to logon screen.

G_Waddell 131 Posting Whiz in Training

Is this a class or code behind a form?

Anyway for a class, create a Sub New() and set your location variable to the location you want then run your ShowMapImage.

If it is a window just do it in the OnLoad event

G_Waddell 131 Posting Whiz in Training

Hi,
A bit Rusty at PDF creation so forgive me but you don't seam to be adding Rows to your pdfTable.

Anyway I would put a check in to see if the datagrid cell had a value:

'......

For Each cell As DatagridViewCell in rows.cells
    If cell.value isnot Nothing andalso cell.value.tostring <> "" then
        pdfTable.AddCell(cell.Value.ToString())
    else
        pdfTable.AddCell("")
    end if
Next
G_Waddell 131 Posting Whiz in Training

I just can't get it to stay closed even if I stay on the same page...

G_Waddell 131 Posting Whiz in Training

Take the relevent fields from one table and pass into an insert statement to run on the other one...

Perhaps if you show what you have tried so far we can give help and guidence

G_Waddell 131 Posting Whiz in Training

Hi,
There are a couple of things I'd try (some of which you may have done already)

  1. Check the Build version under the Project properties
  2. Under the Build menu I would Clean the solution then Build and deploy
G_Waddell 131 Posting Whiz in Training

Just loop through the rows in your grid extract the data you need then use a stored procedure(prefered,) or a SQL Insert statement to add to the other table?

G_Waddell 131 Posting Whiz in Training

No definately don't only one window open the one we're in just now...

G_Waddell 131 Posting Whiz in Training

Hi,

The code you've posted would be for if you were storing your image in a binary format in a database server.

If you are just holding the path to the file, then as David_50 said then why not just populate an image with the path?

G_Waddell 131 Posting Whiz in Training

Hi,
Seeing same behaviour here, it opens I close it, it reopens - it's annoying...

G_Waddell 131 Posting Whiz in Training

Hi,
I've looked at that post and no it doesn't work... What is weird is if I start a brand new project and just keep it simple with one page, an update panel and some controls evrything works 100% it references the correct namespace in the designer and runs first time. So it seems to be peculiar to this project on my machine. We have therefore set up a new project and added all the previous pages to it. So far so good but still annoyingly unexplained.

G_Waddell 131 Posting Whiz in Training

Hi,
The issue appears to be that your program can not initialise the connection to the database.

When you initialise the DRConnection class should you not be passing in your connection string? does the DRconnection class have a default string value? Do you have to call an open connection on the class or does it open as part of the new sub?

Maybe include some of your DRConnection source code?

G_Waddell 131 Posting Whiz in Training

Hi,
You've posted a similar issue on another post...(I answered that one for you) but in that one you were opening the file directly in the browser, this post you are wanting to open the image inside a page? Could you post your ASP.Net page code?

G_Waddell 131 Posting Whiz in Training

Hi,

You're retreiving the image file as a binary object from the database and then you're trying to open directly in the browser?

Do you set the content Type in the response so the browser knows what you are sending it? e.g. Response.ContentType ="image/jpg"

G_Waddell 131 Posting Whiz in Training

Hi,

I don't see where you are setting your Connections connection string, you look to be passing in blank strings on the New DRConnection object (unless you are hiding the values your using for posting here.) so how does your DRConnection know what it is to connect to?

G_Waddell 131 Posting Whiz in Training

Hi all,

I've searched in the ASP.Net and AJAX forums but I can't see any matches to this issue. The reason I'm posting in the ASP.NET forum is that the Error is being caused by my ASP.NET designer page.

Myself and another developer are both working on different parts of a web project. We are supposed to have a standard build of the same OS and we are both using Visual Studio 2013 Premium Update 4. We have both downloaded and installed the same AJAX tool kit. We have the same references (same solution) etc. But when I add an AJAX control to a webpage, (any type of AJAX control script manager or Update panel etc.) I get an error from the designer saying something like Type System.Web.UI.WebControls.UpdatePanel is not defined When My fellow developer adds a control on his machine the reference in the designer points to **System.UI.UpdatePanel ** and if I alter my designer page by hand to the same namespace, it works but then if I make any change to the ASP.net page, the designer page is regenerated with the wrong reference. We have checked everything we can and we are using the same versions of everything we know.

Does anyone have an idea what is causing this?

G_Waddell 131 Posting Whiz in Training

Hi,

That will certainly help with the performance but the UPDATE should still be happening...

G_Waddell 131 Posting Whiz in Training

Hi,

I have to correct some data in SQL Server 2008 R2 database for an accounting system that was accidently over written. Basically I've to take stock items with fixed prices and compare those fixed prices against Sales Order Transactions for the stock item and correct entries where the transaction is not set to the correct price at the time of transaction.

I wrote SQL in a query window on my development database that uses two cursors one to retrieve Stock Items and the other to retrieve transactions and basically if the transaction price does not match the Stock item standard price at the time of the transaction it updates the transaction. This all ran well in the development environment so rather than retype everything I simply saved the window out to a SQL script file.

The issue I have is that when I open the Script file on the live instance (even though I'm logged in as sa) it doesn't change anything.

I tried running in debug mode and I can see each step being performed with no error messages but the UPDATE does not happen.

HERE IS MY CODE:

DECLARE @HistoryID bigint, @ItemID bigint, @TransPrice decimal(18,5),  @TransDate DateTime, @StandardCost decimal(18,5) 

--GET STANDARD PRICED STOCK ITEMS - THEY WILL BELONG TO A PRODUCT GROUP WITH 
--STANDARD COSTING METHOD AND WILL BE NON LABOUR ITEMS

DECLARE CUR_Items CURSOR FOR SELECT StockItem.ItemID FROM ProductGroup INNER JOIN StockItem ON ProductGroup.ProductGroupID = StockItem.ProductGroupID WHERE (ProductGroup.CostingMethodID = 2) AND (ProductGroup.StockItemTypeID <> 2)

OPEN …
G_Waddell 131 Posting Whiz in Training

Hi all,

I feel really stupid but it wasn't my code!!! When I looked at the file size on the clients FTP server it was 1 kb I got my client to open the file on their server and it did have data. So I went back into my windows explorer and tried opening the file - it opened as a blank!! I then selected the option of copying the file to my local hard drive and it was populated. so something funny was happening when I was op the file from the FTP server other than copying it down.

G_Waddell 131 Posting Whiz in Training

Hi,
Yes, i'm streaming the file up and I can see there is a file size of 153 bytes as I said it is a small simple text file. ( I check the file size before I even try to connect to the FTP server.)

G_Waddell 131 Posting Whiz in Training

Hi good people of Danniweb,

I've looked at a lot of examples on line and I cannot figure out what is going wrong.

My program has to transfer a simple delimited text file from the local machine up to a specified directory on a FTP server.

After I have run the routine, I can see the file in the correct directory in the FTP server BUT it is empty i.e. no text.

I tried copying the same file to the same directory via windows explorer and it copied up so I don't think there is an issue with rights or firewalls or lack of content.

Here is the routine I use:

public bool UploadFileToFTP(string FileName)
        {
            Uri serverUri = null;
            FtpWebRequest request = null;
            FileInfo fi = null;
            FileStream sourceStream = null;
            byte[] fileContents = null;
            Stream requestStream = null;
            FtpWebResponse response = null;
            int bytesSent;
            try
            {
                if (_FTPURL.Trim() == "")
                {
                    MessageBox.Show("FTP Address has not been specified. Please check your settings.", "No FTP Address", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return false;
                }
                serverUri = new Uri(_FTPURL);
                if (serverUri.Scheme != Uri.UriSchemeFtp)
                {
                    //Not a valid FTP address
                    MessageBox.Show("The FTP Server URL is not in a valid FTP format.", "Unable to Save Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return false;
                }
                if (_FTPUser.Trim() == "")
                {
                    MessageBox.Show("FTP Username has not been specified. Please check your settings.", "No FTP User", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return false;
                }
                if (!File.Exists(FileName))
                {
                    MessageBox.Show("Unable to locate file " + FileName + ". Has it been moved or deleted?", "Missing File", MessageBoxButtons.OK, …
G_Waddell 131 Posting Whiz in Training

Hi,

Not sure what exactly is happening here as I'm used to dealing with Microsoft SQL server rather than Oracle but here goes:

I have a C# project that connects to an Oracle database using the OracleCommand Object to bring back records but I've been noticing some strange behaviour.

Here is an example, if I have a table in Oracle with 3 rows (or records) in it and run the following query in my code SELECT * FROM MYTABLE it will return only two rows! If I run the same query through TOAD I get all 3 rows.

Does anyone out there know why this is the case?

G_Waddell 131 Posting Whiz in Training

Hi,

Looking at your code, you are referencing a class OExcelHandler to populate your dataset, with out knowing what happens in the class I can't help.

If it uses a dataadaptor, you could be able to specify the Update command if it is accessible.

G_Waddell 131 Posting Whiz in Training

There is a great advert for toilet tissue here where the wife is helping the child draw a picture on paper and the husband pulls out his tablet and shows a graphics app to them saying "Karen" while shaking his head. Next clip, the couple are relaxing on the couche and she takes out a book and he takes out the tablet and again "Karen" while shaking his head and so on. The final scene is him in the toilet, he reaches for the toilet paper but it's finished, he shouts "Karen" and then sees his tablet being pushed under the door with a picture of a toilet roll on it. The tag line is paper has a future

Stuugie commented: I like it! +0
diafol commented: heh heh +0
G_Waddell 131 Posting Whiz in Training

I think Ireland will beat France.

  1. France didn't beat Scotland , Scotland snatched defeat from the jaws of victory - too many silly errors - trying to bypass attacking players when you're about to get a two man overlap!
  2. This weekend is St. Patricks Day weekend!
  3. BOD's last game in an Irish shirt
G_Waddell 131 Posting Whiz in Training

What really annoys me especially with having a young < 1 child in the house is you are watching the show at a reasonable volume when suddenly the adverts come on at what sounds like twice the volume waking the sleeping baby....

Also, in terms of most sci-fi, why if you have a military space ship do you equip it with a brilliant white gleaming hull so it shows up beautifully? I don't see the various Navys throughout the world painting their ships a nice hi-vis pink for example! That is one of the things I like about the Battlestar Galatica reboot, the military ships were black / dark grey

Why did no one actually discover that Jessica Fletcher in Murder She Wrote was actually not a nice lady writer but a deprived serial killer who routinely framed "suspects" for her crimes (how else could she be involved in so many murder cases in the sleepy village of Cabbot Cove,) come to thnk of it, how many people lived in Cabbot Cove? Per head of population it must have been murder capital of the US!

G_Waddell 131 Posting Whiz in Training

In Ireland they wasted millions of euro on electronic voting machines that ended up sitting in a warehouse unused. The problem was the press, IT professionals and eventually general public all spoke out because there was no real audit trail to prove non vote tampering and double voting BUT here's the rub if there was then people would come out a complain the ballot was no longer confidential!

G_Waddell 131 Posting Whiz in Training

My opinion is for certain tasks no. That being said I do have a Google tablet, my wife has an IPad and my son has a tablet too. One thing I can see a tablet being really handy for is instead of having to cart a load of textbooks into school, is that they should be able to down load them on to tablets and then bring in a single tablet.

I use my tablet for playing the odd game, watching netflix when travelling and surfing the web but to use it for anything else requires at least a keyboard and I have a laptop that has that built in, is more powerfull and nearly as portable.

As for desktop, I actually don't use one anymore we have one at home hooked up to the TV for if we want to watch netflix but that's about it. At work we all have laptops and docking stations so we can bring them to client sites if we need to.

I think one of the reason Windows Surface has struggled is they have tried to get the tablet to be more than a big smart phone and more like a laptop but have instead ended up with a product that is neither fish nor fowl with the result being people who want a machine for mainly entertainment buy a tablet, people who need it mainly for work buy a laptop and(if they need it,) a cheap tablet and poor old compromised Surface …

G_Waddell 131 Posting Whiz in Training

hi,

Looking at your code it should be something like: dim MyKeyValue as string = CType(myKey.GetValue("prevhost.exe"),String)

G_Waddell 131 Posting Whiz in Training

Hi,

If you are using a single dataset to hold the two tables you can also specify a DataRelation between them.

You can then get the child records of the parent record and vice versa.

Again you will still need to specify a parent primary key to child foreign key in your relationship though.

G_Waddell 131 Posting Whiz in Training

Hi all,

I have a Windows 7 64 bit client that is running a 32 bit of software and so needs a 32 bit ODBC connection to the database. I of course ignored the Administrative Tools > ODBC manager because that will open the 64 bit and instead went to c:\windows\syswow64\odbcad32.exe to input the system DSN connection. I went through the wizard and when I went to select the database got a message to say the server could not be accessed. I checked on the DB server that the SQL service was running, that the firewall had all necessary ports opened (it does as other clients can connect), that the SQL browser service was running (using a named instance,) that the instance had TCP and Named pipe connections enabled, and tested the username and password I'm using directly against the Database with SQL Server Manager.

The client machine is using a 3rd party Firewall and it says it is not blocking the ports ( I also tried switching off the firewall) but still get the error so I tried changing the client configuration to Named Pipes and could then connect when running the test at the end of the ODBC wizard. BUT when I ran the software, I still get an unable to open the database error!!

I went back to the ODBC setting and discovered that it had not kept the change to named pipes but had reverted back to TCP - Does anyone know why this is happening? …

G_Waddell 131 Posting Whiz in Training

Hmmm... I think I understand what you are trying to do

Why not have the menu items show only the appropriate options on the called form? e.g.

sub MenuItem1_OnClick()
    dim MyForm as new form1

    with MyForm
        .Item1.visible = true
        .Item2.visible = false
        .item3.visible = false 
        .item4.visible = true
        'and so on
        .showdialog
    end with
end sub

 sub MenuItem2_OnClick()
    dim MyForm as new form1

    with MyForm
        .Item1.visible = false
        .Item2.visible = true
        .item3.visible = false 
        .item4.visible = true
        'and so on
        .showdialog
    end with
end sub

'etc
G_Waddell 131 Posting Whiz in Training

Hi
Does it highlight where the end of statement is expected?

Also do you handle if cmdLetter(index) is out of bounds?

G_Waddell 131 Posting Whiz in Training

Never used gembox...

G_Waddell 131 Posting Whiz in Training

Well,

You could put the example I've given you into your save button click event.. OR
look at the update method for datadaptor in the link I gave you.

G_Waddell 131 Posting Whiz in Training

OK you'll need to do something like this:

Public Class MyFomattedTextbox
    Inherits System.Windows.Form.RichTextbox

    Public Overrides Function ToString()
        'parse the text inside the richtextbox
        'if you find " " then format the text between each one      
       dim i, x as integers
       i =instr(me.Text, chr(34))
       while i <> 0
           'got first " - find the next
           y = (i, me.text, chr(34))
           if y = 0 then
               exit while
           else
               'format the string between i and y
               i = y + 1
           end if
           if i > len(me.text) then
               exit while
           end if
       end while
    End Function

End Class
G_Waddell 131 Posting Whiz in Training

Hi
You will need to based your new class on a richtextbox to allow different formating within the text. You will also need to overwrite the ToString to parse the input and format the text accordingly

G_Waddell 131 Posting Whiz in Training

Hi,

How are you initially populating the datagrid? Are you using a DataAdapter?
If so you can specify the Update method for it as shown on the link I have provided.

As for your code, because you are "firing off" the command with an execute non query and then changing the command each time the loop runs, you will have to redeclare the command each time you go through the loop:

 Dim ConnStr as string ="Your connections string"
 Dim cmdConn as sqlconnection = new sqlconnection
 cmdConn.ConnectionString = ConnStr
 Dim cmd as sqlcommand
'dim your period stuff -note I haven't actually done anything with the command
'Now your loop 
For i as integer = 0 to datagridview2.rows.count-1
    'do your thing with the rows and columns
    'check your coinnection is open
    if cmdConn.State <> Open then cmdConn.open        
    'Now set your command up
    cmd = new sqlcommand()
    cmd.CommandText = "Your command text - I'm not typing all that"
    cmd.Connection = cmdConn
    cmd.executenonquery
    cmd.dispose

 Next
G_Waddell 131 Posting Whiz in Training

hi,

You could see if the listitem is already contained within the second Listview with the Contains method.

Failing that, you would loop through each item in the second Listview item and compare to the item you wish to add. If you do not find a match, then add it.

G_Waddell 131 Posting Whiz in Training

DIIIIIIIIIIIIIEEEEEEEEEEE!

Because it is the start to Lawnmower Deth's Thrash metal version of the Osmond's Crazy Horses... and I'm a bit odd like that...

G_Waddell 131 Posting Whiz in Training

Why was the sand wet?

Because the sea weed...

G_Waddell 131 Posting Whiz in Training

Hi,
I think we are trying to do too much on one line of code and screwing up the syntax. So how about this?

'Tidy up your source data first 
dim SourceRange = oWorkbook.Sheets("APOIO").CELLS(A1:A100)
   SourceRange.Text = SourceRange.Text.Trim
'Now use the tidied data to populate the dropdown   
With oSheet.Range(oSheet.Cells(2, j), oSheet.Cells(100, j)).Validation
   .Add(Type:=Excel.XlDVType.xlValidateList, AlertStyle:=Excel.XlDVAlertStyle.xlValidAlertStop, Operator:=Excel.XlFormatConditionOperator.xlBetween, Formula1:="=APOIO!$A$2:$A$100")
   .IgnoreBlank = True
End With
G_Waddell 131 Posting Whiz in Training

dim inquirybyyearmonthday(20)()() as byte

So to clarify further.... an array that contains 20 arrays of undetermined length that themselves contain arrays of undetermined length... of type byte

G_Waddell 131 Posting Whiz in Training

You could also use e.handled=true just to add to the fire...