Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. What kind of errors are you getting when attempting to run the application on a 64bit OS compared to on a 32bit OS? When you say it 'errors on a timer event' what is the error you are getting? What is the timer event trying to do?
  2. could you not use .ToString("00") to return the number as a string? i.e. the following would product output like 00 01 02 ... 08 09 10 11 12 13 ... 98 99 100 for(int i=0;i <= 100;i++) Debug.WriteLine((i.ToString("00")));
  3. You could use a zip file but specify zero compression, that way there is no performance hit due to compression / decompression. Also if you are using zip compression each file is compressed individually, you would not need to decompress 6000+ files to get to a file near the end of the archive.
  4. Have you set any authorisation rules for the web site under the web.config? If not asp.net will allow any user in regardless of the iis settings. Under the web.config there are two relevant sections - Authorisation and Authentication, as a minimum try setting them to [highlight=xml] [/highlight] these instruct asp.net to use windows authentication and the deny users="?" prevents anonymous access.
  5. PlausiblyDamp

    Dpi

    If you open the shortcut's properties there should be a compatability tab - it is one of the options available.
  6. Have you checked the NTFS permissions on the folder itself?
  7. In all honesty you will probably find the best answer regarding the ieframe.dll question is to upgrade the project and try it... (I would strongly advise making sure you have the current version checked into your source control just in case though) The installer should however upgrade the previous version to the new version regardless of framework / vs version used to build the application.
  8. PlausiblyDamp

    Dpi

    If you bring up the properties for the application's shortcut there should be an option to disable scaling for high DPI - does that have any effect?
  9. Told you I was no good with regex ;)
  10. You could try a regular expression - something like string s = "Sample SAMPLE"; s = System.Text.RegularExpressions.Regex.Replace(s, "[aA]", "b"); I've not a clue if there is a better way though as regular expressions aren't my thing ;)
  11. Is anyhting being logged by sql in window's event logs?
  12. Are there any entries in the web.config file under the section that denies these people access?
  13. Have you considered using an actual database for this? SQL Express is free and for a limited number of users would probably be ideal in this situation.
  14. The context menu should have a .SourceControl property - that will be the control the menu is opened on.
  15. http://www.codeproject.com/KB/XML/WSfromJava.aspx might be worth a read, it covers exactly this situation.
  16. What code are you using to load the html? When it fails to load the image what does the relevant html source from the control look like?
  17. The lines While reader.Read Debug.Print(reader("username")) 'this displays value in console End While are effectively 'using up' the data reader. A DataReader can only be used once - after you have walked through it's rows it has no more use. If you remove the debug loop it should be fine.
  18. Off the top of my head it looks as though you are sending the request to the webservice without specifying which web method should handle it. Did you try adding a web reference though like Nate Bross suggested? It would be far easier to do it that way...
  19. It looks as though obj.Query(sqlStatement, err) isn't returning a valid SqlDataReader. If you step through the code are there any errors happening in the Query function?
  20. You cannot create a DataReader directly - the framework itself will create one for you as part of the .ExecuteReader method. Try changing your original method to Private Sub frmUsers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim reader As SqlDataReader 'No longer using the New keyword Dim sqlStatement As String, err As String sqlStatement = "SELECT username, password, fullname, accesslevel FROM users" reader = obj.Query(sqlStatement, err) If reader.HasRows Then DataGrid.DataSource = reader End If End Sub
  21. http://www.xtremedotnettalk.com/showthread.php?t=83092 might be worth a quick look as it covers the basic differences between VB6 and .Net forms.
  22. You could replace the parametercollection with a generic list of parameters like Public Function Search(ByVal sqlStatement As String, ByVal cparam As List(Of SqlParameter), Optional ByRef e As String = "") As String Try Dim cm As New SqlCommand cm.Connection = cn 'Set a Connection cm.CommandText = sqlStatement 'Execute SQL Statement cm.Parameters.AddRange(cparam.ToArray()) cm.CommandType = CommandType.Text 'Refers that the command is SQL and not Stored Proc Search = cm.ExecuteScalar() 'Execute the SQL Statement Catch ex As Exception e = ex.ToString Search = "ER" End Try End Function and call it like Private Sub buttLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttLogIn.Click Dim sqlStatement As String, UserID As String, err As String = "" Dim paramcollection As New List(Of SqlParameter) sqlStatement = "SELECT UserID FROM username WHERE username = @username AND password = @password" paramcollection.Add(New SqlParameter("@username", boxUserName.Text)) paramcollection.Add(New SqlParameter("@password", boxPassword.Text)) UserID = Search(sqlStatement, paramcollection, err) MsgBox(UserID & " " & err) If UserID <> "ER" Then Me.Close() End If End Sub The problem you are having with your original code is down to reusing the same parameter object for both parameters - the second set of property assignments are over writing the first set. As an aside I would also recommend against catching the exception and returning a string - it is easier to let the calling routine catch the error in this case i.e. your search routine could be similar to Public Function Search(ByVal sqlStatement As String, ByVal cparam As List(Of SqlParameter)) As String Dim cm As New SqlCommand ' cm.Connection = cn 'Set a Connection cm.CommandText = sqlStatement 'Execute SQL Statement cm.Parameters.AddRange(cparam.ToArray) cm.CommandType = CommandType.Text 'Refers that the command is SQL and not Stored Proc Search = cm.ExecuteScalar() 'Execute the SQL Statement End Function and the calling code similar to Private Sub buttLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttLogIn.Click Dim sqlStatement As String, UserID As String Dim paramcollection As New List(Of SqlParameter) sqlStatement = "SELECT UserID FROM username WHERE username = @username AND password = @password" paramcollection.Add(New SqlParameter("@username", boxUserName.Text)) paramcollection.Add(New SqlParameter("@password", boxPassword.Text)) Try UserID = Search(sqlStatement, paramcollection) Catch ex As Exception 'error occurred so deal with it however... End Try If Not UserID Is Nothing Then Me.Close() End If End Sub or an alternate way could be Private Sub buttLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttLogIn.Click Dim sqlStatement As String, UserID As String Dim paramcollection As New List(Of SqlParameter) sqlStatement = "SELECT UserID FROM username WHERE username = @username AND password = @password" paramcollection.Add(New SqlParameter("@username", boxUserName.Text)) paramcollection.Add(New SqlParameter("@password", boxPassword.Text)) UserID = Search(sqlStatement, paramcollection) If Not UserID Is Nothing Then Me.Close() End If End Sub Public Function Search(ByVal sqlStatement As String, ByVal cparam As List(Of SqlParameter)) As String Try Dim cm As New SqlCommand ' cm.Connection = cn 'Set a Connection cm.CommandText = sqlStatement 'Execute SQL Statement cm.Parameters.AddRange(cparam.ToArray) cm.CommandType = CommandType.Text 'Refers that the command is SQL and not Stored Proc Return cm.ExecuteScalar() 'Execute the SQL Statement Catch Return Nothing End Try End Function
  23. What version of .Net / Visual Studio are you using? When I cut and paste your code it fails to compile on the line Dim paramcollection As New SqlClient.SqlParameterCollection because SqlParameterCollection doesn't have a public constructor.
  24. Parameters are still a lot safer and cleaner removing the single quotes won't prevent other forms of injection attack. You are also creating extra work somewhere else - either the SQL code now needs to convert all double ' to single ones to store things correctly or any code that retreives these records needs to remove the duplicate ' character. If the data isn't only used by your app then any other applications, web pages, reports etc. are now resposible for cleaning up the returned vales. Parameters really are safer and cleaner as solutions go.
  25. It is a bit trickier than it looks if you want to do this from a separate process - if so http://blogs.msdn.com/jmstall/archive/2005/02/04/367506.aspx is worth a look. If you want to modify an existing application to redirect it's debug output then you want to look at tracelisteners - the built in ones will allow you to log to text and the console for starters.
×
×
  • Create New...