Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. Certain bits of a UDF can be parametrised however the function as a whole needs to be deterministic (as Mister E mentioned). This does restrict the functionality of a UDF - it can't update DB state, can't use non-deterministic functions or stored procs etc. Depending on what you are attempting to do the may be an alternate way, also http://weblogs.sqlteam.com/jeffs/articles/1490.aspx might be worth a read as it does give a method of using non-deterministic functions.
  2. If you just need to track two data items then create a class or structure to hold the Name and Age and store this structure in a single dimension array.
  3. Try changing the if block to if dbo.aw_shiftsonend(@excavator) = 'True' and @datetime >= @shft_start and @datetime <= Convert(datetime,'23:59:00') Set @return = Dateadd(day,1,@return) else begin if @datetime >= convert(datetime,'00:00:00') and @datetime <= @shft_end Set @return = DateAdd(day,-1,@return) end
  4. You could always parameterise the UDF to accept a Date parameter and when you call it pass in the result of GetDate()
  5. Depends on what you mean by if you just want a re-usable library of functions that can be called from a webpage then you can create the DLL as a ClassLibrary and simply reference it from your web application. If you mean something else then could you give a little more detail...
  6. Foreign keys are defined at the field level - if a field contains a list of values then it would probably be better to break the field down into either multiple fields or a related table.
  7. A default constraint cannot access inforamtion outside of the row itself, however if you create a User Defined Function that does access something like MAX([whatever]) + 1 this can be used in a default constraint.
  8. Rather than using Collections you are probably better off with something like an ArrayList - you can then simply use the .IndexOf method to check to see if an item is in the ArrayList rather than looping through them yourself. IIRC Collection is really nothing more than the VB6 collection object and as such doesn't have the same features of the newer collection / list classes.
  9. Clipboard.SetDataObject(textBox1.text, True)
  10. How are you saving the file currently? If you are using a StreamWriter then at least one of the overloads allows you to specify an encoding.
  11. You cannot nest the line namespace Thycotic.Web.UI.WebControls inside an already existing namespace.
  12. As a rule it really helps if people post whatever thay have got at the moment or at least some information about the system they are working with. If you have a simple control on a web page (label, textbox etc.) and a dataset then at design time you can use the properties wind to setup databinding (top option in the properties window) If you are using code to do this then you should look at the DataBinding class in the framework. this normally entails using code similar to the following within the HTML of the page. Text='<%# DataBinder.Eval(Container.DataItem, "UnitPrice", "{0:c}") %>'
  13. If you are using any form of authentication windows or forms you can always use User.Identity.Name to get the logged on username rather than going through the request object. If you step through the code in a debugger does it call the Session_Start event everytime or just for the 1st time? Also do you notice the SessionIDs changing or remaining the same between refreshes?
  14. System.IO.FileStream.Read as a method will allow you to read a file straight into a byte array - that is probably the 1st thing to look at. Are you still wanting to read into a ADODB field or will that be converted to ADO.Net?
  15. If you have an exact format(s) you deem to be valid the DateTime.ParseExact is probably the easiest way. Out of curiosity is the date being entered via a windows / web application? If so you may find using a control like the DatetimePicker for a windows app or a validation control for a web app would prevent incorrect input being entered.
  16. Could you post the exact code you used to parse the string "12" as it definately doesn't parse when I trie it here. Also DateTime.ParseExact may do what you need without requiring RegEx.
  17. What is the actual error that is raised?
  18. Could you post the code you are using as it should be returning the server's date and time.
  19. ASP.Net code runs on the server - you could simply use Datetime.Now to get the date on the server the code is executing.
  20. Why don't you create a class that holds both a class and a command (plus any other information required) and store these in the HashTable?
  21. If you step through this in a debugger what is the value of _value when you get the error? Also storing object arrays inside a HashTable is probably not going to win any 'Best OO Practices' awards, if you give a bit more detail about what you are trying to do there may be a better / easier way to handle the problem
  22. Firstly you could simplify the reading of the file a bit by using Dim hashSHA1 As New SHA1CryptoServiceProvider Dim objNewFile As FileStream = New FileStream("C:\TestCode\tblDetlBBB.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite) Dim objFileName As FileStream = New FileStream(strOutputDecrypt, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) Dim sArray(objFileName.Length - 1) As Byte and remove the need for the StreamReader object. However the problem is probably the line msNewStream.Write(sArray, 0, sArray.Length - hashsize) as you are not including the last 20 bytes of the original sArray, you need to allocate 20bytes more than the filesize rather than remove the last 20 bytes.
  23. Just a quickie but what version(s) of the framework is installed on the Win2k3 box? Also which version is the application configured to use?
  24. Ideally you wouldn't want to return any database specific information to the front end from your classlibrary - just have methods that return / accept the data types your business logic uses. The data access library should completely hide and abstract away the underlying DB type. One thing you could do is make the classlibrary as DB neutral as possible and develop a plugin style system to handle the DB specific functionality (connections, commands etc.), this way when you need to support a new or different DB vendor you only need to (re)write the DB specific functionality and nothing else needs to be modified or re-deployed.
  25. You will be unable to browse to a web service via Visual Studio if you have a proxy that requires authentication information to be provided, in that case you can use the command line WSDL.EXE tool to generate the wrapper class. WSDL /? will give you the command line arguments needed to do this.
×
×
  • Create New...