|
i wont to make a program can send and reserve data over the Internet like peer to peer ???????? please help quickly!!!!!
|
|
|
|
|
|
Hello !
I'm using VB.net and sql server 2008R2.
Inside my application I have 2 commands : Backup and Restore that create a backup of database and restore a backup file to sql server.
These 2 commands are working , but I have a problem :
The .bak file is not protected , so someone can restore it to a sql server even without my program.
Is there anything that I can do when create the .bak file in order that :
- The file can be restored only within my application
- 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.
Thank you !
|
|
|
|
|
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.
|
|
|
|