helpful linq to sql article
http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx
Achievement provides the only real pleasure in life
http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx
Posted by
SF
at
10:49 am
0
comments
found this helpful
http://visualstudiohacks.com/general/confessions-of-a-keyboard-junkie/
Posted by
SF
at
11:14 am
0
comments
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + RadUpload.UploadedFiles[0].FileName+";" +
"Extended Properties=Excel 8.0;";
OleDbConnection objConn = new OleDbConnection(sConnectionString);
objConn.Open();
OleDbCommand cmdSelectAdditions = new OleDbCommand("SELECT * FROM [Sheet1$]", objConn);
OleDbDataAdapter AdapterForAdditions = new OleDbDataAdapter();
AdapterForAdditions.SelectCommand = cmdSelectAdditions;
DataSet dsAdditions = new DataSet();
AdapterForAdditions.Fill(dsAdditions);
objConn.Close();
Posted by
SF
at
4:16 pm
0
comments
this article helped me, hope it helps you too!
http://www.4guysfromrolla.com/articles/030911-1.aspx
I need to parse HTML into the pdf, the implementation is:
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Transactions.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Document document = new Document(PageSize.A1, 10f, 10f, 10f, 0f);
PdfWriter.GetInstance(document, Response.OutputStream);
// Open the Document for writing
document.Open();
string documentContent = string.Empty;
document.NewPage();
documentContent = "Confirmation" + "
" + body;
StringReader sr = new StringReader(documentContent);
foreach (object item in HTMLWorker.ParseToList(sr, null).ToList())
{
document.Add((IElement)item);
}
document.Close();
Response.Write(document);
Response.End();
Posted by
SF
at
2:18 pm
0
comments
found this article very helpful
http://support.microsoft.com/kb/306572/
I modified it a bit to work for me (I am using RadUpload to get the file):
// Create connection string variable. Modify the "Data Source"
// parameter as appropriate for your environment.
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + ruImporter.UploadedFiles[0].FileName+";" +
"Extended Properties=Excel 8.0;";
// Create connection object by using the preceding connection string.
OleDbConnection objConn = new OleDbConnection(sConnectionString);
// Open connection with the database.
objConn.Open();
// The code to follow uses a SQL SELECT command to display the data from the worksheet.
// Create new OleDbCommand to return data from worksheet.
OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM [Sheet1$]", objConn);
// Create new OleDbDataAdapter that is used to build a DataSet
// based on the preceding SQL SELECT statement.
OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
// Pass the Select command to the adapter.
objAdapter1.SelectCommand = objCmdSelect;
// Create new DataSet to hold information from the worksheet.
DataSet objDataset1 = new DataSet();
// Fill the DataSet with the information from the worksheet.
objAdapter1.Fill(objDataset1);
// Clean up objects.
objConn.Close();
Posted by
SF
at
10:09 am
0
comments
this script only works with combination of firstname+' '+lastname.
--firstname
SUBSTRING(fullname, 1, CHARINDEX(' ', fullname) - 1) as firstname
--lastname
SUBSTRING(fullname, CHARINDEX(' ', fullname) + 1, LEN(fullname)) as lastname
Posted by
SF
at
12:16 pm
1 comments
thanks to many similar sources on the web, I came up with my script, it splits up a comma seperated string into a table with duplicate records removed
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Spliter]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].Spliter
GO
CREATE FUNCTION Spliter(@String varchar(max), @Delimiter char(1))
returns @temptable TABLE (items varchar(max))
as
begin
declare @idx int
declare @slice varchar(8000)
select @idx = 1
if len(@String)<1 or @String is null return
while @idx!= 0
begin
set @idx = charindex(@Delimiter,@String)
if @idx!=0
set @slice = left(@String,@idx - 1)
else
set @slice = @String
if(len(@slice)>0 and (select count(items) from @temptable where items = @slice)=0)
insert into @temptable(Items) values(@slice)
set @String = right(@String,len(@String) - @idx)
if len(@String) = 0 break
end
return
end
GO
SELECT i.items FROM dbo.Spliter(@tempstring,',') AS i where items not in (select comparesource from comparesourcetable)
Posted by
SF
at
11:09 am
0
comments
found these properties quite handy when you want to give end user limited access when designing the report in web browser, especially when you want to hide the connection string credentials.
StiWebDesignerOptions.Dictionary.AllowModifyDictionary = true;
StiWebDesignerOptions.Dictionary.AllowModifyConnections = false;
StiWebDesignerOptions.Dictionary.ShowConnectionType = false;
StiWebDesignerOptions.Dictionary.AllowModifyDataSources = false;
StiWebDesignerOptions.Dictionary.AllowModifyVariables = true;
just put them before swdCustomReport.Design(report); in your code
Posted by
SF
at
11:33 am
1 comments
I got this message:
Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-cretead.
the solution is:
Tools > Options > Designers > Table and Database Designers
unselect 'Prevent saving changes that require the table to be re-created' check box
Posted by
SF
at
10:07 am
0
comments
var rtbName = $find("<%= rtbName.ClientID %>");
rtbName.set_value('Hello World');
Posted by
SF
at
12:05 pm
0
comments
SUBSTRING([TheString], patindex('%[^0]%',[TheString]), 10)
Posted by
SF
at
11:44 am
0
comments
public static Color FindeOppositeColor(Color InputColour)
{
return Color.FromArgb(255 - InputColour.R, 255 - InputColour.G, 255 - InputColour.B);
}
Posted by
SF
at
1:02 pm
0
comments
sometimes i need to open radwindow from server side, I use this code snippet from Telerik:
protected void Button1_Click(object sender, EventArgs e)
{
Telerik.WebControls.RadWindow newwindow = new Telerik.WebControls.RadWindow();
newwindow.ID = "RadWindow1";
newwindow.NavigateUrl = "http://www.google.com";
newwindow.VisibleOnPageLoad = true;
RadWindowManager1.Windows.Add(newwindow);
}
newwindow.Width = Unit.Pixel(500);
newwindow.Height = Unit.Pixel(500);
newwindow.Behaviors = WindowBehaviors.Move | WindowBehaviors.Close;
Posted by
SF
at
7:45 pm
0
comments
what a frustrating 5 minutes....
try Windows key + Up key
enjoy
Posted by
SF
at
3:05 pm
0
comments
oldPath and newPath should look like "c:/FolderABC" or "~/FolderABC"
System.IO.Directory.Move(@oldPath, @newPath);
Posted by
SF
at
5:38 pm
0
comments
found this useful to keep necessary usage of disk space with sql db installed
USE myDatabase
GO
DBCC SHRINKFILE(myDatabase_log, 1)
BACKUP LOG myDatabase WITH TRUNCATE_ONLY
DBCC SHRINKFILE(myDatabase_log, 1)
Posted by
SF
at
11:16 am
0
comments
found the solution at:
http://www.telerik.com/community/forums/aspnet-ajax/editor/incorrect-rendering-of-radeditor-when-shown-with-ajax-in-initially-hidden-parent.aspx
Posted by
SF
at
11:14 am
0
comments
when I enter a random text instead of an integer into the filter, and select any option in the filter options dropdown, i get error
the solution is kind of tricky:
EnableLinqExpressioins property of grid as false
Posted by
SF
at
5:28 pm
0
comments
in my radgrid i use template as EditFormType. When I open the edit form for a grid item I want to show or hide a texbos based on the value populated in it. It can be achieved this way:
Protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem item = (GridEditFormItem)e.Item;
TextBox TextBox1 = (TextBox)item.FindControl("TextBox1");
//OR/// TextBox txtbox = (TextBox)item["TextBox1"].Controls[0];
if (TextBox1.Text == "your value")
{
TextBox1.Visible = false;
}
}
}
Posted by
SF
at
1:30 pm
0
comments
I use the following line in code behind to open a radwindow:
During as soon as I opened the window once, any postback will cause this window to popup again.
The solution is simple, just put the following code into page_load event.
RadWindow1.Visible = false;
Posted by
SF
at
8:56 am
0
comments