|
DELETE FROM [ORDERDETAILS] WHERE [DELETE] IS NOT NULL
DELETE FROM [ORDERS] WHERE [Delete] IS NOT NULL
satc wrote: The idea is to do the deletion with a single query. That is technically not possible. You can execute them as a single command that success as fails or a whole. The code would obivously need to be in a transaction.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Ok , but if the database has 100+ tables , if I get one by one the tables master and Childs as you suggest , do you think is a good solution ?
|
|
|
|
|
I am not going to repeat my answer.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi. I have to create an console application, that grabs an xml file via a network share (unc-path)
With the following function I read the xml-file.
Dim filePath As String = "C:\temp\demo.xml"
dsJobStatus.ReadXml(filePath)
dvJobStatus = New DataView(dsJobStatus.Tables(0))
Works fine if the user that runs the exe has access rights to that fileshare; but somtimes I do have to pass username / Password as parameter. Any idea, how I can access the unc-path with passing access credentials?
regards
|
|
|
|
|
net use[^]
Execute the command on a console before executing your code or from your code and wait until it exits.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Appologize if this is childish question but i am in too much confusion.
I learnt first language vb6.0 in 2008 then i was student later and i continue it many years then 2 years ago i shifted to vb.net but in markete there is demand of c#. Many peoples told that c# is better than vb.net that,s why there is no value of vb.net in markete. I still can,t find any job to work in vb.net while i know vb well. Then i learnt C++ and i learnt it well and then i moved to c# and now i can code in c#.
But problem is that i can,t code in c# same as in vb.net. I mean i always prefer vb. In vb i can solve any problem. but in c# i have to search from start and i don,t know why i like vb.net too much. In other words i don,t want to leave vb but markete always force to work in c# and foget vb. If vb is too bad in markete then why microsoft still supports it. Microsoft must close vb because they can,t give good markete to vb. Due to this reasons vb only developers are still poor in markete. They can switch to c# easly but their hearts shall always stick with vb.
I know many languages like vb,c#,java,asp.net,php,mysql,sql etc but my heart always stick with vb.
|
|
|
|
|
|
Message Closed
modified 5-Jan-17 22:39pm.
|
|
|
|
|
But javascript is only scripting language. It can,t create desktop or android applications. I mean it is not equal to vb.net because in vb.net we can develop in desktop,web and cell phone also.
|
|
|
|
|
Hello !
I have a vb.net program , where I want to save on a database several things , and the actual time.
The problem is that the local pc clock may have problems.
Is there any way that if internet connection is present , to get the real date and time ( for my time zone ) from internet and to save to a variable ?
Thank you !
|
|
|
|
|
A Google search will find all you need to know about NTP servers.
|
|
|
|
|
In a VB.net 2010 desktop application, reports obtain their values to execute by users selecting values from the various vb.net controls. In 2 columns where there are date pickers, the default value of the date pickers is to use today's date.
The application passes values from the controls using the following code:
Private Sub dtEnddate_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtEnddate.ValueChanged
Variables.g_strEndDate = dtEnddate.Text
End Sub
Private Sub dtEnddate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles dtEnddate.Click
Variables.g_strEndDate = dtEnddate.Text
End Sub
The problem is if the user keeps todays date, and does not change the date, the variables.g_strEndDate never gets a value. These variables I am referring to are in a Public Class Variables and the variable is define as Public Shared g_strEndDate As String.
Thus can you tell me the best way to give this column default values of today's date? What code would you use and where would you place the code?
|
|
|
|
|
classy_dog wrote: Thus can you tell me the best way to give this column default values of today's
date? You could initialize it with a value when the application starts.
classy_dog wrote: What code would you use I would recommend removing the global variable altogether. If it is a dialog, then the values should be returned upon closing the dialog and passed to the method that needs them.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Is there some reason that you cannot simply give the variables default values when you declare them?
You can lead a developer to CodeProject, but you can't make them think.
The Theory of Gravity was invented for the sole purpose of distracting you from investigating the scientific fact that the Earth sucks.
|
|
|
|
|
Wrong approach!
Store dates as dates, not string! String represenation may differ in different localization/culture.
Always initialize variables! It can save you from stress
|
|
|
|
|
In a VB.NET 2010 desktop application, I am using the following new logic to load values into a combo box.
Public dirAccessFiles As String() = Directory.GetFiles("H:\FilesTest", "*.accdb")
Try
Dim dir As String
For Each dir In dirAccessFiles
cboAccessFile.Items.Add(Path.GetFileNameWithoutExtension(dir))
Next
Catch except As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
The user wants the file names to be in descending order in the combo box. Thus, can you tell me how to modify the code list above and/or would you show me code on how I can load file names into the combo box in descending order?
|
|
|
|
|
That means you need to set the Sorted property to False , and sort the names manually before adding them to the Combo.
|
|
|
|
|
WHat Richard MacCutchan said - but personally I wouldn't bother with any "manual" sorting method / algorithm. Instead, add a listbox, set its Visible property to false, and Sort = True. Then load the items into that and let tt take of sorting them. Then, to get reverse order, just read the items in reverse and load them into your combo box.
|
|
|
|
|
Would you show me how to write the code you suggested here," Instead, add a listbox, set its Visible property to false, and Sort = True. Then load the items into that and let tt take of sorting them. Then, to get reverse order, just read the items in reverse and load them into your combo box."? Could you give me at least a start on how to set this up?
|
|
|
|
|
Well...
Add ListBox1 to form
set
ListBox1.Visible = False
ListBox1.Sorted = True
Public dirAccessFiles As String() = Directory.GetFiles("H:\FilesTest", "*.accdb")
...
For Each dir In dirAccessFiles
ListBox1.Items.Add(Path.GetFileNameWithoutExtension(dir))
Next
Dim I as integer
For I = ListBox1.Items.Count - 1 To 0 Step -1
cboAccessFile.Items.Add(ListBox1.Items(I))
Next
|
|
|
|
|
That's a toe-curling suggestion.. please see my answer below
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Bah - only to purists! Technically, you are quite right of course, but I suspect Linq is a bit beyond our OP at present. Then it depends on one's motivation; there's nothing wrong with "cheating" if getting a working result is what matters. Even if this isn't the best place to use it, this "cheat" is a useful way of sorting items without resorting to complex methods, which our OP could use elsewhere. But without a knowledge of Linq, your answer would be used "by rote" and the OP would learn nothing - other, perhaps, than that maybe he should learn about Linq.
I am not really trying to say I'm right and you're not - of course you are; just that there can be a place for the quick (because it doesn't require learning new methods) and dirty solutions sometimes.
|
|
|
|
|
Wombaticus wrote: but I suspect Linq is a bit beyond our OP at present You're probably right there but it can also be done without Linq:
Dim dirAccessFiles As String() = Directory.GetFiles("H:\FilesTest", "*.accdb")
Dim list As New List(Of String)()
For Each dir As String In dirAccessFiles
list.Add(Path.GetFileNameWithoutExtension(dir))
Next
list.Sort()
For i As Integer = list.Count - 1 To 0 Step -1
comboBox1.Items.Add(list(i))
Next
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
This is true - and I have to admit that this obvious solution only occurred to me belatedly. Still, my "trick" has many applications! (I'm not giving up on it that easily! )
|
|
|
|
|
Wombaticus wrote: Still, my "trick" has many applications! (I'm not giving up on it that easily! )
I didn't yet have to resort to some such trick - do you have an example where it can't be easily replaced with some non-control-using code?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|