|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
#16
|
||||
|
||||
|
Quote:
This is language dependent, VB.NET is &, C# is + |
|
#17
|
|||
|
|||
|
write the code test.aspx.vb
Like ASP you abl to write to write the code in test.aspx page
but writing the code in the test.aspx.vb is preferred in .NET B,coz the code from the page test.aspx.vb is not scene by any one i.e. when website is deployed all the code in test.aspx.vb is placed in a dll so more security. |
|
#18
|
|||
|
|||
|
Quote:
What do you suggest we use instead of Response.Write? |
|
#19
|
||||
|
||||
|
What are you needing to display that you would need to use Response.Write?
|
|
#20
|
|||
|
|||
|
I use Response.Write during development to display debugging and troubleshooting information, but never in a production-ready application.
|
|
#21
|
|||
|
|||
|
In my case the question was answered in another post
Thanks ![]() |
|
#22
|
||||
|
||||
|
this is no breakthrough, but since i am new to this stuff, i was typing some things out the long way. now that i've figured out ways to improve my script, etc, i figured other people might like to save time typing so...
this: Code:
SUB TRIM_COMMENTS
DIM CN668 AS OLEDBCONNECTION
DIM DA668 AS OLEDBDATAADAPTER
DIM DS668 AS DATASET
DIM CN66 AS OLEDBCONNECTION
DIM CM66 AS OLEDBCOMMAND
DIM CS66 AS STRING
dim RC AS INTEGER
CN668 = new OLEDBConnection("PROVIDER=MICROSOFT.JET.OLEDB.4.0;Data Source=Z:\WWW\DATA\MX.MDB")
DA668 = NEW OLEDBDATAADAPTER("SELECT CTIME FROM COMMENT WHERE MYNAME='" & REQUEST.QUERYSTRING("UNAME") & "'",CN668)
DS668 = NEW DATASET()
DA668.FILL(DS668,("COMMENT"))
DIM CMS AS STRING = "DELETE FROM COMMENT WHERE MYNAME='" & REQUEST.QUERYSTRING("UNAME") & "' AND CTIME='" & THISTIME & "'"
CM66 = NEW OLEDBCOMMAND(CMS,CN668)
CN668.OPEN
CM66.EXECUTEnonquery()
CN668.CLOSE
CN668 = NOTHING
END SUB
can be done like this: Code:
SUB TRIM_COMMENTS
DIM Con AS new OLEDBConnection(application("DBcon"))
DIM DA_1 AS NEW OLEDBDATAADAPTER("SELECT CTIME FROM COMMENT WHERE MYNAME='" & REQUEST.QUERYSTRING("UNAME") & "'",Con)
dim DS_1 as NEW DATASET()
DA_1.FILL(DS_1,("my_table"))
DIM CM_1 AS NEW OLEDBCOMMAND("DELETE FROM COMMENT WHERE MYNAME='" & REQUEST.QUERYSTRING("UNAME") & "' AND CTIME='" & THISTIME & "'",Con)
Con.OPEN
CM_1.EXECUTEnonquery()
Con.CLOSE
END SUB
... a lot less typing uh? |
|
#23
|
||||
|
||||
|
Tip: if your dropdownlist's VISIBLE text value is the same as it's FORM tag value parameter's value, you can leave out the text value, and the closing </option> tag.
instead of this: Code:
<SELECT RUNAT="SERVER" NAME="ITEM_YEAR" ID="ITEM_YEAR" > <OPTION VALUE="2005" >2005</OPTION> <OPTION VALUE="2006" >2006</OPTION> </SELECT> you can do this: Code:
<SELECT RUNAT="SERVER" NAME="ITEM_YEAR" ID="ITEM_YEAR" > <OPTION VALUE="2005" /> <OPTION VALUE="2006" /> </SELECT> Just something to save you time typing, and less for the parser. |
|
#24
|
||||
|
||||
|
just for the record, your TRIM_COMMENTS method is wide open for SQL injection
attacks.... wise tip for .NET programming is to use the Parameters instead of passing the value directly. |
|
#25
|
||||
|
||||
|
Well, i was just intending to show how to save time with the main body of a common task, but thanx for pointing that out, i didn't catch that myself, i see what you mean now and i will change it.
|
|
#26
|
|||
|
|||
|
I just made a database class that handles all the connection and encapsulation junk, makes life much easier.
__________________
Andrew - DevShed Perl Monkey learning VB.NET |
|
#27
|
||||
|
||||
|
Wow, that's a really good idea, but how easy is it to do for us beginners? And do you know anywhere that a beginner can go to find documentation on how to make your own class?
|
|
#28
|
||||
|
||||
|
The ASP.NET tutorial has a simple DML (Data Manipulation Layer) class, that demonstrates how to create one.
|
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > Coding Tips For .NET |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|