|
satc wrote: s there anything that I can do when create the .bak file in order that :
- The file can be restored only within my application
No. The backup file is written by SQL and you don't have any part or control of that process.
satc wrote: Is there anything that I can do when create the .bak file in order that :
- When I do a restore , to check if the .bak file is a file that is created with my application , otherwise an error should be displayed and no restore should be made.
No, see point 1.
What you CAN do is put the backup files in a location that is protected by normal Windows NTFS security so that only Administrators and the SQL Server process has read and write access to it. Nobody else will be able to see the contents of the folder, nor read/write it even if they knew what the file names were.
satc wrote: Inside my application I have 2 commands : Backup and Restore that create a backup of database and restore a backup file to sql server.
Are you making multiple backup files instead of directly overwriting the previous one? Think about what would happen if your SQL Server died in the middle of overwriting the previous backup file. Just something to think about...
|
|
|
|
|
But after I create the backup , I have a .bak file. Is it possible to do a custom encryption of this file , and to remove encryption before restoring ?
|
|
|
|
|
You could. Depending on the size of the database, this may not be a feasible option as it may take quit a long time to encrypt/decrypt, not to mention available disk space and managing the encryption keys and keeping them secure.
|
|
|
|
|
Ok , but how can I do this process ?
|
|
|
|
|
|
Even if the backup file created by your program is protected, there is nothing to stop an administrator from creating their own backup of the database from SQL, which would not be protected.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Let's suppose that I can prevent this.
My problem is the .bak file . I just want that if someone get this file , I want to prevent that he restore on another server without my program.
|
|
|
|
|
Hi,
I want to drag and drop a cell in datagridview.I can drag and drop a row but I can't a cell. How can I do this?
Thanks
|
|
|
|
|
|
Hi Abhinav S,
Thanks your answer.
I tried the second link you sent and it works but it is emptying the value of moved cell.
I want to change the cells values.
I want to value of column(0) move to column(1) and value of column(1) move to column(0).
I want to transfer value between cells.
Thanks
Emrah
|
|
|
|
|
I created a List, and populated it with an Invoice number and date.
Now I want to delete all the records before the report start date, and after the report stop date.
So I tried this, and now realize theres no way it can work.
I made a copy of the list, and went through the copy, deleting the record in the original.
Trouble is, the original list gets shorter, and the index I used from the copied list no longer matches.
I not sure what to really do here, or how to handle it. Perhaps the RemoveRange would be better to use.
Looking for ideas, or how to acquire the ranges.
'Stage Six, Remove the records not within the date ranges
Dim tSA As New List(Of invoices_by_SA)()
tSA.AddRange(lSA)
Dim lC As Integer = 0
For Each inv As invoices_by_SA In tSA
If (DateTime.Compare(inv.InvoiceDate, p_startDate.ToString("MM/dd/yyyy")) < 0) _
Or (DateTime.Compare(inv.InvoiceDate, p_stopDate.ToString("MM/dd/yyyy")) > 0) Then
lSA.RemoveAt(lC)
End If
lC += 1
Next
|
|
|
|
|
There's a small trick to it: Use a for-loop instead of a foreach-loop and iterate it backwards. Then you can remove as you wish and like:
for idx as Int32 = list.Count-1 to 0 step -1
if ..... then
list.RemoveAt(idx)
end if
next
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Oh I didn't think of that. Duhh
I tried this and somehow it worked. But I'm not sure if it's 100% solid
I should just switch to your method, since you have proven it reliable.
'Stage Six, Remove the records not within the date ranges
Dim tSA As New List(Of invoices_by_SA)()
tSA.AddRange(lSA)
Dim lC As Integer = 0
For Each inv As invoices_by_SA In tSA
If (DateTime.Compare(inv.InvoiceDate, p_startDate.ToString("MM/dd/yyyy")) < 0) _
Or (DateTime.Compare(inv.InvoiceDate, p_stopDate.ToString("MM/dd/yyyy")) > 0) Then
lSA.Remove(inv)
End If
Next
|
|
|
|
|
Your method is solid. I would prefer the for-loop because it has some performance benefits:
- no list copy required
- no enumerator required
- removing the item by index doesn't require an index-search in the list
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
I can't figure this out. This is my first expression of this type.
I just want to write a shipping address into a single textbox on the RDLC report canvas without creating a set of textboxes
So I have tried this.
I don't understand the line numbers, should it be all on one line, or like code where I can use multiple lines.
Perhaps the ampersand is the wrong concat char to use, or the way I tried to create spaces is wrong.
=Parameters!address_Streetline1.Value & System.Environment.NewLine & Parameters!address_Streetline2.Value & System.Environment.NewLine & Parameters!address_City & " " & Parameters!address_StateCode & " " & Parameters!address_PostalCode & " " & Parameters!address_CountryCode
=Parameters!address_Streetline1.Value & System.Environment.NewLine &
Parameters!address_Streetline2.Value & System.Environment.NewLine &
Parameters!address_City & " " &
Parameters!address_StateCode & " " &
Parameters!address_PostalCode & " " &
Parameters!address_CountryCode
<pre>
|
|
|
|
|
I got schooled in expressions. I forgot the values part
=Parameters!address_Streetline1.Value & VbCrLF &
Iif(Parameters!address_Streetline2.Value = "", nothing, Parameters!address_Streetline2.Value & VbCrLF) &
Parameters!address_City.Value & " " &
Parameters!address_StateCode.Value & " " &
Parameters!address_PostalCode.Value & " " &
Parameters!address_CountryCode.Value
|
|
|
|
|
I'm struggling with a simple task of finding the Index of a line in a Listbox based on the first two characters of the string, Listbox line item.
My best code finds the index of the last item, not the item containing the specified search string.
Private Sub Command1_Click()
Dim find As String, i As Long, found As Boolean
find = "0,3"
For i = 0 To List1.ListCount - 1
If StrComp(find, List1.List(i), vbTextCompare) = 0 Then
found = True
List1.SetFocus
List1.ListIndex = i
Exit For
End If
Next
MsgBox " Index # is: " & i
End Sub
Sample Listbox lines: ("-" indicates a space, forum wouln't display spaces)
0,0 - Item one - Item two - 4/27/2015 9:15:00 AM
0,3 - Item one - Item two - 4/27/2015 9:25:00 AM
0,1 - Item one - Item two - 4/27/2015 10:15:00 AM
0,2 - Item one - Item two - 4/27/2015 10:25:00 AM
So the result of the above is: 4, not 2. My attempts at using 'Left' haven't worked.
Any advice appreciated.
|
|
|
|
|
You are trying to compare different length strings. You need to extract the first characters from the list item before doing the compare.
|
|
|
|
|
[Solved]
I created a function to select and read 0 to List1.ListCount items, split lines at each comma, and compare the first two values of each line. When the correct pair of values are found, that index is deleted, and the listbox is refreshed.
modified 28-Apr-15 0:21am.
|
|
|
|
|
Have you tried something like this?
If StrComp(find, Left(List1.List(i), 3), vbTextCompare) = 0 Then
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
I run my application and i have this error:
Échec de la demande d'autorisation de type 'System.Data.OleDb.OleDbPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
|
|
|
|
|
Something needs permission.
|
|
|
|
|
Something needs permission to run but since we know nothing about what your code was doing at the time, what this application is supposed to do, how you're running it, ..., nothing, there's nothing anyone can tell you that would be helpful.
The quality of the answer you get is directly dictated by the quality of the question you ask.
|
|
|
|
|
Hi,
I have two VB.Net Projects. For Example Project1 and Project2. I make exe to Prject2. Project1 has one MDI Form. I want to run Project2.exe in MDI_Form in Project1 when click a button in Project1.
I can run to Project2.exe from Project1 but it doesn't run in MDI Form in Project1. It's open in another window.
Thanks.
|
|
|
|
|
Every process will open in it's own window. You cannot prevent that. There is also no standard way of getting the window into another application as this is something that is not supported.
It can be done, though you may not like the results. You have to create a MdiChild form in your MDI project. Don't put anything on the form. When you launch your other project, create an instance of your child form and set it up as a MdiChild as normal.
After you launch your other process, you have to wait until the Process.WaitForInputIdle is true to be sure the process window has been created. When that finally happens, you can get the Process.MainWindowHandle property value. You then call the Win32 API function SetParent to reparent the process window to your child form. Your essentially making your MdiChild form the new Desktop window for your other app.
BUT YOU HAVE NO CONTROL OVER THE BEHAVIOR OF THE CHILD PROCESS WINDOW! Users can maximize, minimize, move, whatever, ... the process window inside your MdiChild form. There's really nothing you can do to prevent this.
|
|
|
|