Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

mikasa

@mikasa
About
Posts
122
Topics
32
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • HRESULT in VB.NET
    M mikasa

    I do agree that you need to code the API Call as neccessary and I only use IntPtr when it's neccessary. However, I would disagree, you can easily get the Interger Value from an IntPtr.

    Dim h As IntPtr = IntPtr.Zero
    Debug.WriteLine(h.ToInt32)
    Dim h2 As New IntPtr(h.ToInt32)

    :-D

    Visual Basic csharp c++ tutorial

  • Cryptography
    M mikasa

    Ok, well I knew I needed the CultureInfo Class...but I have no idea how to go about using it! I guess I will try to create an InvariantCulture and set it to the Current Culture of the Thread. I will save the existing Culture first so I can restore it later. Does anyone have an example of this? :wtf:

    Visual Basic question graphics security cryptography performance

  • HRESULT in VB.NET
    M mikasa

    Actually, it might be an IntPtr DataType...

    Visual Basic csharp c++ tutorial

  • Cryptography
    M mikasa

    Ok, I've had an Encrypt / Decrypt routine for a year now, but now I'm wondering if I am missing something in it. It seems that anyone with different Languages installed on their PC, the Decrypt cannot decrypt data on a PC with standard English. So, how can I enable my encryption routine to handle Locales?? I know that I need to convert the String into Locale specific data, but I am not sure where in this code. Any help is appreciated.

    Public Class ICrypto
    '<><><><><><><><><><><><><><><>
    #Region "Methods"

    'Function to Return a Key
     \_
    Private Shared Function GetKey(ByVal Data As String, ByVal KeySize As Integer) As Byte()
    	Dim nSize As Integer = CInt((KeySize / 8) - 1)
    	Dim vKey(nSize) As Byte
    	If (Data.Length >= 1) Then
    		Dim lastBound As Integer = Data.Length
    		If (lastBound > nSize) Then lastBound = nSize
    
    		For i As Integer = 0 To lastBound - 1
    			vKey(i) = Convert.ToByte(Data.Chars(i))
    		Next
    	End If
    
    	Return vKey
    End Function
    
    'Function to Get the Initialization Vector
     \_
    Private Shared Function GetIV(ByVal Data As String, ByVal BlockSize As Integer) As Byte()
    	Dim nSize As Integer = CInt((BlockSize / 8) - 1)
    	Dim vVector(nSize) As Byte
    	If (Data.Length >= 1) Then
    		Dim lastBound As Integer = Data.Length
    		If (lastBound > nSize) Then lastBound = nSize
    		For i As Integer = 0 To lastBound - 1
    			vVector(i) = Convert.ToByte(Data.Chars(i))
    		Next
    	End If
    
    	Return vVector
    End Function
    
    'Function to Encrypt Data
     \_
    Public Shared Function Encrypt(ByVal Data As String, ByVal Password As String, Optional ByVal ConvertToBase64 As Boolean = True) As String
    	Dim provCrypto As Cryptography.SymmetricAlgorithm
    	Dim mEncryptor As ICryptoTransform
    	Dim stCrypto As Cryptography.CryptoStream
    	Dim stMemory As IO.MemoryStream, stWriter As IO.StreamWriter
    	Dim vData() As Byte
    	Dim sData As String
    
    	'Exit if there is no Data
    	If (IsNothing(Data)) Then Return String.Empty
    	If (Data.Equals(String.Empty)) Then Return String.Empty
    
    	Try
    		'Initialize the Crypto Provider (3DES)
    		provCrypto = Cryptography.TripleDES.Create()
    		provCrypto.KeySize = 128
    		provCrypto.BlockSize = 64
    		provCrypto.Mode = CipherMode.CBC
    		provCrypto.Padding = PaddingMode.PKCS7
    
    		'Initialize the Memory Stream and Encrypt the Data
    		vData = ConvertStringToBytes(Data)
    		stMemory = New IO.MemoryStream
    		mEncryptor = provCry
    
    Visual Basic question graphics security cryptography performance

  • DataSet with GUIDs
    M mikasa

    Ok, for some unknown reason, this now works when I know before it didn't :wtf:

    Database database question sql-server sysadmin xml

  • Dealing with special characters in SQL queries
    M mikasa

    I'm with you there. In VB6, I never used databinding! I hated it and it was flaky. Now, however, .NET has made vast improvements with DataBinding! I've been able to Code Business Layers and UIs with very little code at all! Not only that, it's great having the ability to Map DataColumns to DataCommand Parameters and be able to use Stored Procs to update data. And it doesn't stop there, you can even get Values from the DB with "Output" Parameters! :-D

    Database database help tutorial csharp

  • SQL and the growing log file
    M mikasa

    If you're not concerned with the Log, change it to "Simple" mode on the Server. I am pretty sure though that if you are backing up the Logs, it will shrink the Log, but I can't be sure off the top of my head.

    Database database help

  • Dealing with special characters in SQL queries
    M mikasa

    I used to think exactly like you. The point is not redundancy though, it's ease of programability (I think I just made that word up) and also being able to handle unforseen problems before they even occur (i.e. handling any character). Did you know that you can bind DataAdapters to Stored Procs and also bind the Parameters of the Stored Procs to Columns in DataSets? But, whatever floats your boat. You might want to Build seperate routines then for Save and Delete operations that use DataCommand Objects.

    Database database help tutorial csharp

  • Update database from a XML dataset file ?
    M mikasa

    Thr problem with this is that you need to save the XML using a "DiffGram" model. By default, this is not used in the WriteXML and when you Save the XML file and Read it back in, the DataSet thinks there are no changes to be updated. However, one last Quirk, you also need to save the Schema into a different file as well, since you cannot save both the Schema AND the DiffGram into one file.

    Database help database xml question announcement

  • Dealing with special characters in SQL queries
    M mikasa

    Well, stop writing SQL Insert / Update Queries and start using Objects. ADO (and now ADO.NET) lets you enter any damn thing you want into the DB! It has for many years! ;P

    Database database help tutorial csharp

  • DataSet with GUIDs
    M mikasa

    I have a DataTable with a PKey defined as a GUID. The problem is trying to "lookup" values in the DataTable.Select Method. Since this is a GUID column, I cannot do the normal things like I could in SQL Server (i.e. DataTable.Select("ID = '" & sID & "'")). In SQL, the GUID DataType is treated like a String. I generated an XSD Schema of my table, and I got this info for the PKey:

    xs:element name="ID" msdata:DataType="System.Guid, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xs:string"

    How can I get my DataTable to treat my PKey like a String at run time without loading aa Schema first? Or, how can I lookup GUID values in a DataTable??? :omg::wtf:

    Database database question sql-server sysadmin xml

  • DataSet.Merge - Merging Errors
    M mikasa

    Well, I figured this one out. Since I was retrieving data from Views, it wasn't able to determine the P-Keys on its own. I modified the Tables after data retrieval to have the Proper Key Columns on them. Afterwards, it worked great! So I guess in a sense, it was trying to append the same Records twice, and since I had Relationships setup, it was violating the Constraints. ;P

    Visual Basic database help question

  • DataSet.Merge - Merging Errors
    M mikasa

    Ok, I have tried everything there is and I cannot get data to Merge into a DataSet. I have done this before, but now I am having problems with this particular piece of code. Here is the Error:

    Constraint Exception:
    System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
    at System.Data.DataSet.FailedEnableConstraints()
    at System.Data.DataSet.EnableConstraints()
    at System.Data.DataSet.set_EnforceConstraints(Boolean value)
    at System.Data.Merger.MergeDataSet(DataSet source)
    at System.Data.DataSet.Merge(DataSet dataSet, Boolean preserveChanges, MissingSchemaAction missingSchemaAction)
    at...

    The DataSet is retrieved from the DB the first time fine. The DataSet contains 4 DataTables as well as some DataRelations. The 2nd time around, when I am trying to refresh the Data from the DB (but Preserve my changes) I get the above Error. It is absolutely impossible, beyond any doubt, that there are "NULL" values in any Primary Keys or F-Keys used within the DataRelations. What can be causing this? :mad:

    Visual Basic database help question

  • MCP
    M mikasa

    I used the Osborne Certification Press MCAD/MCSD Book for 70-306. It helped a lot for the test and I passed with flying colors. :cool:

    Visual Basic mcp question

  • Download File
    M mikasa

    Download the Application Updater Block from MS Samples and look at the code there.

    Visual Basic csharp sysadmin data-structures help

  • Is there any simple code to delay 1 second?
    M mikasa

    System.Threading.Thread.CurrentThread.Sleep(1000)

    Visual Basic csharp c++ question

  • MSFlexGrid
    M mikasa

    You can't. Learn how to use ADO. MSFlexGridis not a "data aware" control, so you have to program everything manually.

    Visual Basic css database question

  • DataBinding - I'm getting sick of it!
    M mikasa

    Ok, I thought databinding in .NET would be oh so simple, turns out, I'm finding that I am writing the same code whether I Bind or Not! All of these stupid little examples on MessageBoards and MSDN suck! They never cover the REAL topic! How the heck do you save data to the DataView you've bound to, and then, once you re-populate your Data from the Database, how do you rebind your Controls? Or do you even need to!?? Well, here's what I am running into. First off, DataBinding works great! I can Bind and Navigate Records with ease. However, when I go to save, I run into problems since I am using DataRelations. I cannot use the BindingManagerBase of the Form to call "Me.BindingContext(Data).EndCurrentEdit" because then all my changes in Child Tables are GONE! Gone I tell you!!! So, I am forced to use DataRowView variables when attempting to Save, which I connect to Me.BindingContext(Data).Current and Me.BindingContext(Data, DataMember).Current respectively and then call the "EndEdit" Method of those Rows. However, this causes an additional problem. Now, I have to write code which forces the values of my Controls into the Values of the DataRowView Variables (ex. dRow("Column") = TextBox1.Text)! So in other words...I just lost my DataBindings!??? What the @##$% is going on here!? :wtf: Has anybody in the world actually got DataBinding to work with a DataSet that has multiple Child Relations?

    Visual Basic csharp database help question

  • Retrieve Data from Stored Proc
    M mikasa

    Ok, this is very similar to what I tried. Do you think it matters if the Stored Proc is creating and using a Temporary Table (ex. ##TempTable)? I get errors on my Temp Table in the Designer. It doesn't make any sense because I can run this in the Query Analyzer without fail every time!

    Database csharp tutorial question

  • Dataset Filter Interger
    M mikasa

    Does anyone know how to Filter a PKey that is a GUID? For some reason, the standard way of treating GUIDs like Strings (which works great in SQL Server) does not work on DataViews! Anyone have a Clue? :wtf:

    C# question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups