Amir Mirkamali RSS 2.0
 Tuesday, March 03, 2009

You use an *.asmx file to create an ASP.NET Web Service.  This file contains your service implementation and is needed for hosting the service.

ASP.NET automatically generates the WSDL or "service description" for your service by reflecting over the types in your service.  You can see the WSDL for your service by browsing to your ASMX file, which should show you a help page for your service containing a link to the service description for the service.  The WSDL can also generally be reached by appending "?wsdl" to the address of the asmx file.

 

Tuesday, March 03, 2009 8:37:26 AM UTC  #    -
ASP NET 1.0 | ASP NET 2.0
 Tuesday, February 03, 2009
DateTime myDate = DateTime.MinValue; //=> 1/1/0001
SqlDateTime mySqlDate = SqlDateTime.MinValue; //=> 1/1/1753
//Note that SQL Server's smalldatetime min value is 1/1/1900
Tuesday, February 03, 2009 8:03:54 AM UTC  #    -
SQL Server
 Tuesday, January 27, 2009

Response.ContentType = "application/force-download";

Response.AddHeader("Content-Disposition", "attachment;filename=\"" + Filename + "\"");

Response.BinaryWrite(yourbuffer);

Response.End();

Tuesday, January 27, 2009 1:19:08 PM UTC  #    -
ASP NET 1.0 | ASP NET 2.0 | Troubleshooting
 Wednesday, January 21, 2009

if you want to shrink database log file just run this codes with your database name:

BACKUP LOG yourdbname WITH TRUNCATE_ONLY
DBCC SHRINKFILE(yourdbname_log, 2)

this code will shrink and reduce your database log file to 2MB

 

Wednesday, January 21, 2009 7:04:33 AM UTC  #    -
SQL Server
 Monday, December 22, 2008

A WPF browser project is the same as writing a java applet/application, only you use IE and .net instead. you would do it for the same reasons you would write a java application.

The main wpf cons are:

  1. User must have .net installed, and use IE to access the app.
  2. Slow load time (.net vm must be loaded and app jit'd)

the main wpf pros:

  1. Rich UI (winforms)
  2. Coding understood by windows programers

the main asp.net cons:

  1. Programmer must learn web model
  2. Somewhat limited UI
  3. Cross browser testing required

the main asp.net pros:

  1. Cross browser compatiability (universal access)
Monday, December 22, 2008 2:34:28 PM UTC  #    -
ASP NET 2.0
 Tuesday, November 25, 2008

برای حل مشکل کافی است در بخش GlobalSection فایل sln خود خط زیر را اضافه کنید:

SccProjectEnlistmentChoice0 = 2

Tuesday, November 25, 2008 10:28:32 AM UTC  #    -
ASP NET 1.0 | Troubleshooting
 Wednesday, November 19, 2008

Copy and paste the following lines into a Notepad file.

[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop

Rename it to desktop.scf

Wednesday, November 19, 2008 5:11:43 AM UTC  #    -
Troubleshooting

Run  RemoteComponents.hta from your installation cds. navigate and find "install full remote debugging on all operating systems" and push the install full button. I had to many probems with my remote debugger and this solved my problem.

this link was very usefull to understand what is my debugger problem:

http://blogs.msdn.com/mkpark/articles/86872.aspx

Wednesday, November 19, 2008 5:11:23 AM UTC  #    -
ASP NET 1.0 | ASP NET 2.0 | Troubleshooting
SELECT TOP 1 * FROM TableName ORDER BY NEWID()
Wednesday, November 19, 2008 5:10:53 AM UTC  #    -
SQL Server

I got this strange error when tried to overwrite file. I had full control access but i got this error.

The error occured when the file is read only! change the attribute of existing file and you will be able to copy the file!

Wednesday, November 19, 2008 5:10:05 AM UTC  #    -
ASP NET 2.0 | ASP NET 1.0
 Tuesday, November 18, 2008

You can solve this problem with leave the controltovalidate property blank.

Tuesday, November 18, 2008 5:05:59 AM UTC  #    -

Sometimes the schema of a replicated table needs altering. There are many reasons this might be the case eg possibly the datatype has been incorrectly chosen, or a default is missing, or we want to rename a column. Attempting to change the table schema directly will result in the error 

"Cannot alter/drop the table 'tablename' because it is being published for replication". 

So, how to change an existing column without breaking replication? Consider if we wanted to make the following schema change:

to

The method we choose depends in part on the replication type and size of the table, but there are 2 main options: 

(a) altering the subscriptions

  exec sp_dropsubscription   @publication =  'tTestFNames' 
     ,  @article =  'tEmployees' 
     ,  @subscriber =  'RSCOMPUTER'
     ,  @destination_db =  'testrep' 
  

  exec sp_droparticle  @publication =  'tTestFNames'
     ,  @article =  'tEmployees'
  

  alter table tEmployees alter column Forename varchar(100) null
  

  exec sp_addarticle  @publication =  'tTestFNames' 
     ,  @article =  'tEmployees' 
     ,  @source_table =  'tEmployees' 
  

  exec sp_addsubscription  @publication =  'tTestFNames'
     ,  @article =  'tEmployees'
     ,  @subscriber =  'RSCOMPUTER' 
     ,  @destination_db =  'testrep' 
  
For snapshot replication this is the obvious choice. We drop the subscription to this article, drop the article, then change the table. Afterwards the process is reversed. The next time the snapshot agent is run, it'll pick up the new schema without any issues.

For transactional replication we may choose to proceed using the script above. However, we must be more careful in this case. By default, an insert, update or delete statement performed on the publisher is propagated to the subscriber in the form of a stored procedure call. By changing the column definition, we may need to change the related stored procedures on all the subscribers. Addition of a default would be fine, but changing the datatype itself as above would require the stored procedure arguments to be modified. For the example table above, these 3 procedures exist on the subscriber in the form: 

sp_MSins_tEmployees, 
sp_MSupd_tEmployees, 
sp_MSdel_tEmployees. 

They can be generated at the publisher using sp_scriptpublicationcustomprocs but this would of course require the system to be quiesced, i.e. during this (quick) change there shouldn't be any alterations made to the publisher's data and all the subscribers should be completely synchronized. 

This is not ideal, and there is also a hidden problem here waiting to be discovered. Usually, when you add a new article to an existing publication in transactional replication, running the snapshot agent will create a snapshot of just the new article. In our case, it'll also create a snapshot of the 'tEmployees' table. So, to avoid all the issues and complications mentioned above, it's simplest to run the snapshot agent immediately after executing sp_addsubscription and then synchronize.

In merge replication, there is no possibility of dropping the subscription on a per article basis using the script above, as there is in transactional and snapshot replication. If we drop the subscription entirely including all other articles (sp_dropmergesubscription), then try to run sp_dropmergearticle there will be an error if the snapshot has already been run, so we have to set @forceinvalid_snapshot to 1, make the table change on the publisher then read the article and subscriptions and initialize which would necessitate a new snapshot generation of all articles in this publication. A nosync initialization is possible, but this can be extremely restrictive for future changes, and I'll leave that for another article.

(b) altering the table in-place

OK, in some cases the table is large and we don't want to run a new snapshot - either of the individual table (transactional) or of the whole publication (merge) - so there is an alternative method. We might use the built in stored procedures sp_repladdcolumn and sp_repldropcolumn to make the changes (note that these procedures limit the subscribers to be SQL Server 2000 only). Using these procedures we can add a dummy column to hold the data, remove the old column, add in the correct definition of the original column then transfer back the data. Now the script becomes:
  exec sp_repladdcolumn  @source_object =  'tEmployees'
     ,  @column =  'TempForename' 
     ,  @typetext =  'varchar(100) NULL' 
     ,  @publication_to_add =  'tTestFNames' 
  

  update tEmployees set TempForename = Forename
  

  exec sp_repldropcolumn  @source_object =  'tEmployees' 
     ,  @column =  'Forename' 
  

  exec sp_repladdcolumn  @source_object =  'tEmployees'
     ,  @column =  'Forename' 
     ,  @typetext =  'varchar(100) NULL' 
     ,  @publication_to_add =  'tTestFNames' 
  

  update tEmployees set Forename = TempForename
  

  exec sp_repldropcolumn  @source_object =  'tEmployees' 
     ,  @column =  'TempForename'
    
Although the above script can be used for transactional replication or merge replication, the internal methodology is different due to the differing nature of these 2 techniques. For merge replication, details of the rows updated are kept in MSmerge_contents, and if a particular row has been changed once or a hundred times, there will still only be one entry in this system table, while in transactional replication, 100 updates to a row is propagated as 100 subscriber updates. This means merge has an advantage over transactional because we need to perform 2 updates to each row to make the schema change.

 

You can find the main article in: http://www.sqlservercentral.com/articles/Replication/alteringacolumnonareplicatedtable/1666/

 

Tuesday, November 18, 2008 5:02:53 AM UTC  #    -
SQL Server
 Sunday, November 16, 2008

Add your code in button click add this code (replace your link in the code)

 private void btn_Click(object sender, EventArgs e)
{

.....

 StringBuilder script = new StringBuilder();
script.Append("<script>");
script.AppendFormat("window.open('{0}', '', '');", link);
script.Append("</scri");
script.Append("pt>");
Page.RegisterStartupScript("opennewwindow", script.ToString());

.....

}
Sunday, November 16, 2008 3:03:06 PM UTC  #    -
C#
public DataView GetTopDataViewRows(DataView source, int count)
{
    DataTable output = source.Table.Clone();
    for (int i = 0; i < count; i++)
    {
        if (i >= source.Count)
            break;
        output.ImportRow(source[i].Row);
    }
    return new DataView(output, source.RowFilter,     source.Sort, source.RowStateFilter);
}
Sunday, November 16, 2008 3:02:15 PM UTC  #    -
C#

There are two ways :

  1. EXEC sp_dboption 'pubs', 'single user', 'TRUE'
  2. alter database pubs set SINGLE_USER  WITH ROLLBACK IMMEDIATE
To deactive single user mode :
  1. EXEC sp_dboption 'pubs', 'single user', 'FALSE'
  2. 2- alter database pubs set MULTI_USER 
Sunday, November 16, 2008 3:00:17 PM UTC  #    -
SQL Server

just run sp_who stored procedure.

Sunday, November 16, 2008 2:59:50 PM UTC  #    -
SQL Server
CREATE TABLE #TmpWho
(spid INT, ecid INT, status VARCHAR(150), 
loginame VARCHAR(150), hostname VARCHAR(150), 
blk INT, dbname VARCHAR(150), cmd VARCHAR(150))

INSERT INTO #TmpWho
EXEC       sp_who

DECLARE @spid INT     
DECLARE @getspid CURSOR     

SET @getspid = CURSOR FOR     
      SELECT       spid
      FROM      #TmpWho
      WHERE       dbname = 'YOURDBNAME'

OPEN @getspid     

FETCH NEXT FROM @getspid INTO @spid     

WHILE @@FETCH_STATUS = 0 
BEGIN
 KILL @spid --SELECT @spid works fine here
FETCH NEXT FROM @getspid INTO @spid
END
CLOSE @getspid 
DEALLOCATE @getspid 

DROP TABLE #TmpWho
Sunday, November 16, 2008 10:21:22 AM UTC  #    -
SQL Server

If FLV files do not appear in the player and you get 404 error it means that you need to add a mime type for flv files.

add MIME-Type for .FLV extentions with the proper mime-type "flv-application/octet-stream"

Sunday, November 16, 2008 10:20:26 AM UTC  #    -
Troubleshooting
  • Create a virtual directory at the root of your default website
  • Name the virtual WebAdmin
  • Set the Path of the Virtual Directory to "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\ASP.NETWebAdminFiles" where 50215 is the appropriate build version for your installed .NET 2.0 framework.
  • After the Virtual Directory has been created, right click on the Virtual Directory and got to properties.  Select the ASP.NET tab and make sure the ASP.NET version is set to a 2.0 version.
  • Open a browser and browse to the following url:
    http://localhost/webadmin/default.aspx?applicationPhysicalPath=D:\wwwroot\timetracker\&applicationUrl=/Timetracker
  • Make sure to change the applicationPhysicalPath and applicationUrl querystring parameters to match whatever they are on your system.
Sunday, November 16, 2008 10:18:37 AM UTC  #    -
ASP NET 2.0
DECLARE @tableCatalog VARCHAR (1024) , 

@tableSchema VARCHAR (1024), @tableName VARCHAR (1024), @tableType VARCHAR (1024)
DECLARE cursorTemp CURSOR FOR
SELECT * FROM INFORMATION_SCHEMA.TABLES
OPEN cursorTemp
FETCH cursorTemp INTO @tableCatalog, @tableSchema, @tableName, @tableType


-- start the main processing loop.
WHILE @@Fetch_Status = 0
BEGIN
    EXEC (' ALTER TABLE '+@tableName+' NOCHECK CONSTRAINT ALL;' +
    ' DELETE FROM '+ @tableName +';'+
    ' ALTER TABLE '+@tableName+' CHECK CONSTRAINT ALL ') 
    FETCH cursorTemp INTO @tableCatalog, @tableSchema, @tableName, @tableType
END

CLOSE cursorTemp
DEALLOCATE cursorTemp
Sunday, November 16, 2008 10:15:16 AM UTC  #    -
SQL Server
 Wednesday, November 12, 2008
Defferent between Stored procedure and User Functions
Wednesday, November 12, 2008 6:48:11 AM UTC  #    -
SQL Server
 Wednesday, November 05, 2008

You change wrap property with white-space property in css.
normal : Default. White-space is ignored by the browser
pre : White-space is preserved by the browser. Acts like the pre tag in HTML
nowrap : The text will never wrap, it continues

Wednesday, November 05, 2008 5:38:38 AM UTC  #    -

Archive
<March 2009>
SunMonTueWedThuFriSat
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234
Blogroll
About the author/Disclaimer

استفاده از مطالب سایت با ذکر منبع آزاد است

© Copyright 2012
Amir Mirkamali

Statistics
Total Posts: 40
This Year: 0
This Month: 0
This Week: 0
Comments: 1
Themes
All Content © 2012, Amir Mirkamali