Wednesday, November 05, 2008

Calling Javascript from C#, Calling Javascript from Codebehind ASP.NET

Calling Javascript from C#, Calling Javascript from Codebehind

We can use the following two methods to access Java Script from C#
Page.ClientScript.RegisterStartupScript() Method
Page.ClientScript.RegisterClientScriptBlock() Method

Eg:

string script = "< LANGUAGE='JavaScript'> ";
script += "ApptConfirm()";
script += "</SCRIPT>";

// We use RegisterStartupScript, so that this script is executed after all form elements are rendered.
Page.RegisterStartupScript("ClientScript", script);

Monday, November 03, 2008

loading csv file to SQL Server

loading csv file to SQL Server

CREATE TABLE CSVTest
(FirstName VARCHAR(40),
No1 INT,No2 INT,No3 INT,No4 INT)
GO

select * from CSVTest


BULK
INSERT CSVTest
FROM 'd:\Tesing.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO


select * from CSVTest

If there is a error in a particular row that row will not be added.
rest of the rows will be loaded into sql server.

.csv file
vijay,20,19999,90000,8
Jagadeesh,9,111,60000,9