Example of command file:
cd "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin"
wsdl /out:c:\CrmProxy.cs /n:YourCrmService http://localhost/MSCRMServices/2007/CrmServiceWsdl.aspx?wsdl
четверг, 24 июля 2008 г.
среда, 23 июля 2008 г.
Execute T-SQL script from C# code
if (filename.Length > 0)
{
try
{
// Open the file to read from.
using (StreamReader sr = File.OpenText(filename))
{
string queryString = sr.ReadToEnd().Replace("GO", "");
using (SqlConnection connection = new SqlConnection(ASSettings.ConnectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
MessageBox.Show("Script executed.", "Result", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show("Error script execution!\n" + ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
{
try
{
// Open the file to read from.
using (StreamReader sr = File.OpenText(filename))
{
string queryString = sr.ReadToEnd().Replace("GO", "");
using (SqlConnection connection = new SqlConnection(ASSettings.ConnectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
MessageBox.Show("Script executed.", "Result", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show("Error script execution!\n" + ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
четверг, 17 июля 2008 г.
Repair DBF structure (if damaged file header)
SET TABLEVALIDATE TO 3
CD "C:\Repair\"
OPEN DATABASE osago EXCLUSIVE
VALIDATE DATABASE TO FILE before.txt
lnDBF = ADIR(laDBF,"*.dbf")
FOR i = 1 TO lnDBF
TRY
USE (laDBF[i,1]) EXCLUSIVE
CATCH
SET TABLEVALIDATE TO 0
USE (laDBF[i,1]) EXCLUSIVE
MESSAGEBOX("Table "+laDBF[i,1]+" could not be opened. "+CHR(13)+;
"Please delete any damaged records (Ctrl-T). "+CHR(13)+;
"Press Ctrl-W when finished",16)
BROWSE
SET TABLEVALIDATE TO 3
FINALLY
PACK
REINDEX
ENDTRY
NEXT
VALIDATE DATABASE RECOVER TO FILE after.txt
CD "C:\Repair\"
OPEN DATABASE osago EXCLUSIVE
VALIDATE DATABASE TO FILE before.txt
lnDBF = ADIR(laDBF,"*.dbf")
FOR i = 1 TO lnDBF
TRY
USE (laDBF[i,1]) EXCLUSIVE
CATCH
SET TABLEVALIDATE TO 0
USE (laDBF[i,1]) EXCLUSIVE
MESSAGEBOX("Table "+laDBF[i,1]+" could not be opened. "+CHR(13)+;
"Please delete any damaged records (Ctrl-T). "+CHR(13)+;
"Press Ctrl-W when finished",16)
BROWSE
SET TABLEVALIDATE TO 3
FINALLY
PACK
REINDEX
ENDTRY
NEXT
VALIDATE DATABASE RECOVER TO FILE after.txt
Подписаться на:
Сообщения (Atom)