Recently, i worked with MS SQL Server and i needed to backup a table. With Mysql database, this is a simple job. Infact , i think that mysqldump is very simple and quickly method. SQL Server provide with Management Studio an automatic backup also easy to use, but this permit to backup only the entire Db. After some google search i found the solution, bcp command, follow a sample.
For backup a table from my db i wrote :
bcp mydb.mytable OUT c:\export.txt -n -S dbserver -T
and to restore :
bcp mydb.mytable IN c:\import.txt -n -S dbserver -T
Where the parameters :
-n -> maintains the native type of the table
-S -> the db server
-T -> trusted connection
There are many other options, see the image below.

ww
Recently i read a post talks about LINQO. With this instrument the use of LinqtoSQL became less heavy.
Infact with this is possible to create a complete project using existing template.
A great important things is the dbml synchronization with the database tables, i think that is a great plus because recently i worked in a WCF project where the dbml must be continuously refreshed…really bad!
Now i would to try PLINQO at 360° …
Che LinQ fosse una notevole innovazione, tutti ne saranno d’accordo. Ma non tutti sanno di cosa stiamo parlando, quindi ne diamo la definizione ufficiale :
LinQ è l’acronimo di Language Integrated Query ovvero Linguaggio di interrogazione integrato.
Tale linguaggio è integrato nel .NET Framework e consente di fare interrogazioni su qualsiasi collezione di oggetti,DataBase e XML. Lasciando da parte LinQ to SQL, che sto tuttora usando, quello che mi ha dato lo spunto per scrivere questo post è stato un caso reale incontrato oggi in ufficio.
Ho una classe Assegno così strutturata con degli attributi tipo : ID, Numero, Data, Importo.
Ora supponiamo di avere una lista generica di Assegni:
1
| List<Assegno>assegni= new List<Assegno>(); |
Il mio problema era quello di dover fare la somma di tutti gli importi degli Assegni, nessun problema infatti:
1
2
3
| int somma=0;
foreach (Assegno a in assegni)
somma+=a.Importo; |
Molto semplice ma macchinoso, analizziamo ora la versione LinQ:
1
| int somma = (from a in assegni select a.Importo).Sum(); |
Troppo potente! Lo sò l’esempio è banale ma vi assicuro che LinQ può fare molto di più,
magari vedremo altro nei prossimi post.
A presto.