The ConnectionString property has not been initialized.
????
:D
it is sooo easy. but you can waste a lot of time on this one.
Here is what was my problem:
1.) web.config:
< appSettings >
< add key="aaa" value="server=swoosh\sqlserver2k5;database=swdb;uid=sa;password=;" />
< / appSettings >
2.) accessing:
string strConnRSS = System.Configuration.ConfigurationManager.AppSettings["bbb"];
yes.
aaa <> bbb
Hope this'll help someone :)
don't look for anything too complicated :)
SQL, C#, VB, .net, asp, JavaScript, you name it. Code samples, Error messages and stuff like that. Please add coments if you think I said something stupid :D or if you have a better idea ... or anything at all ...
Monday, September 29, 2008
Friday, September 19, 2008
Monthname in C# (C Sharp)
I think there's no Monthname (like is asp for ex. - which is weird)
But this is easy:
DateTime swTest = new DateTime(2000, 11, 1);
Page.Response.Write(swTest.ToString("MMMM"));
But this is easy:
DateTime swTest = new DateTime(2000, 11, 1);
Page.Response.Write(swTest.ToString("MMMM"));
Monday, September 1, 2008
SQL - add zeros to the left
Ever needed to add zeros to the left of your string?
For example: instead of "1", you need "0001" displayed.
All this from SQL ...
I think this is an easy way of doing that:
select replicate('0', 6-len(convert(varchar(50), 'aaa'))) + convert(varchar(50), 'aaa')
You need to change the '6' if longer, and 'aaa' is your string ...
what do you think?
comment!
For example: instead of "1", you need "0001" displayed.
All this from SQL ...
I think this is an easy way of doing that:
select replicate('0', 6-len(convert(varchar(50), 'aaa'))) + convert(varchar(50), 'aaa')
You need to change the '6' if longer, and 'aaa' is your string ...
what do you think?
comment!
Calling a server side from client's Javascript
Did you ever need something like calling a server side thing from client's? Javascript ... ?
I think this is an easy way of doing that:
Response.Write ( " < script language="javascript"> function SetPmoR_Id() { document.all('" + lkbPmoRepAdd.ClientID + "').click(); } < / script>")
//or:
ClientScript.RegisterClientScriptBlock(this.GetType(), "somethn", " < script type='text/javascript'> function whatdoyouwannacalit() { try {document.all('" + yourlinkbutton.ClientID + "').click();} catch(e){} } < / script>");
what do you think?
you think there's an easier way? comment!
I think this is an easy way of doing that:
Response.Write ( " < script language="javascript"> function SetPmoR_Id() { document.all('" + lkbPmoRepAdd.ClientID + "').click(); } < / script>")
//or:
ClientScript.RegisterClientScriptBlock(this.GetType(), "somethn", " < script type='text/javascript'> function whatdoyouwannacalit() { try {document.all('" + yourlinkbutton.ClientID + "').click();} catch(e){} } < / script>");
what do you think?
you think there's an easier way? comment!
Labels:
C#,
client side,
Dot Net,
JavaScript,
server side,
VB.Net
Subscribe to:
Posts (Atom)