I do and can not know if this code is correct for your purpose.
I have no idea what the content of these textboxes is.
If TextBox1.Text contains the name of your table and TextBox2.Text contains the name of the primary key or another identifying column in that table, then: yes this is correct...
Yes, it is.
Const DeleteSQL As String = "DELETE FROM {0} WHERE {1} = @PK"
cmd.CommandText = String.Format(DeleteSQL, tableName, pkName)
' ...
But this is rarely really necessary.
You could also define several Const strings (one for each table) for the delete statements.
Const...
Something along the lines of:
cmd.CommandText ="DELETE FROM Liquor WHERE [Product Id] = @Id"
cmd.Parameters.AddWithValue("Id", productId )
cmd.ExecuteNonQuery
where productId is the [Product Id] you want to remove.
Do not concatenate your SQL strings, always use Parameter objects .
Are you sure you are looking in the right database?
The database where your insert is executed is in the bin/debug or bin/release directory.
Furthermore: if you added the database file to your project, check the property "Copy to Output Directory".
If it says "Copy Always", the database in the...
Combobox2.SelectedValue is Nothing.
Use
TextBox4.Text = String.Format("{0}", Combobox2.SelectedValue)
or test for Nothing
If Combobox2.SelectedValue IsNot Nothing Then
TextBox4.Text = Combobox2.SelectedValue.ToString
Else
TextBox4.Clear
End If
Also: do yourself a favour and give your...
With file, do you mean assembly (.dll) or just code file?
If they're in the same assembly: always put your custom and usercontrols in a separate assembly .
You are probably running a previous version of your program?
That is not the problem here.
The problem seems to be that you have some assembler code and you seem to have no clue about what it does.
Says who?
No, trying to assign the value 181 (decimal) or B5 (hexadecimal) to a System.SByte, will result in a System.OverflowException.
Take a step back...
So actually you have no idea what your assembler code does?
Where did you get that code?
I think it is the equivalent of this Delphi code
beginStartPositie := ZoekStartPositie + 181;
Is that possible?
Also: .NET has several encryption libraries. Why not use one of those?
Try
Array.Sort(stary, StringComparer.CurrentCulture)
With my current culture this returns aAbBcCdD (still not what you wanted).
What CultureInfo is your CurrentCulture?
Use System.IO.Directory.GetDirectories to get the folders as an array of strings, or System.IO.Directory.GetFileSystemeEntries to get both files and folders as an array of string.
Or use one of the System.IO.DirectoryInfo methods:
EnumerateDirectories Method...
What happens if you set a breakpoint in the event handler for the first dropdown?
Does the eventhandler execute?
If it does you probably selected a folder with no files in it.
Can you show your relevant code and relevant markup?
Only if you don't know the location of the file.
Load the lines in a List(Of String) with a StreamReader and your algorithm is as simple as: aRandomInstance.Next(list.Count)
If you need to repeat the random picking of a name, you could shuffle the list once.
Did you set the AutoPostBack property of the first dropdown to True?
If not, the DropDown.SelectedIndexChanged event does not fire.
Also be sure the selected folders has files, otherwise the second DropDownList stays empty.
Did you set a breakpoint in both event handlers to verify if they are...
I myself would prefer to go the Ajax route.
Nevertheless, following example should demonstrate in plain no-ajax WebForms mode how to get the files displayed in the dropdown:
Note: the DropDownFolders dropdown has it's AutoPostback property = True, which is not necessarily a good idea and a...
...TextBox)
Sub AddRow()
Dim count As Int32 = 1 + boxList.Count \ 3
Dim current As New AddressControl
current.Top = count * current.Height
boxList.AddRange(current.GetBoxes)
Me.PanelControls.Controls.Add(current)
End Sub
Private Sub...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.