Tuesday, March 13, 2012

So Lost...

Unfortunately my wife won't let me have any money to buy any books so I need to ask help form you guys.. :)

Ok... First off let me start by saying I am new to ASP especially ASP.Net... So someone please answer a few questions for me... (Please keep the answers simple ;) )

ok,

#1: Anyone with online tutorials please send them my way..

#2: Most books/Tutorials I have found seem to make an assumption I am working with a "Local" server when in fact I have my site hosted through another server... Would someone post a "commented" example of connecting to a database on a remote server and explain maybe displaying a field or two of data? (I will try to hash out more as I learn)...

#3: How secure can I make my data on the net using ASP or is the method of putting the information in a "secure" directory still the best way?

Any help is greatly appreciated...

Anjarisome good examples can be found at asp.net in the starter kit,
also I found the quickstart tutorials fairly informative.

How you connect to a datasource depends on how the server is set up if your using sql server use the sqlclient and for the connection string u need to include the source name, user id and password.
Dim ds as new dataset()
Dim strconn as string = "Connection string")
Dim conn as new sqlclienct.connection(strconn)
Dim adptSql as new sqlclient.data("sqlstatement",conn)
adptSql.fill(ds)

' creates a populated dataset that you can then use in a datalist or datagrid or a number of other controls.

I hope this helps a little
this should get you started...

http://www.w3schools.com/aspnet/default.asp
http://msdn.microsoft.com/vbasic/downloads/samples/default.asp

When connecting to a DB you will use the same string to connect. The only thing different about developing on your local server and a regular server will be the address you use to access your pages:

http://localhost/pbss/deletebid.aspx
http://yourServer/pbss/deletebid.aspx

heres some code where I connect to a db and then run query and populate some txtboxes on my page with the results:

Dim strConnection As String = "Provider=MSDAORA;Password=" & password & ";User ID=" & userid & ";Data Source=" & database
Dim strSQL As String = "select pbss_bid.bid_id,bid_type_code,buyer_name,post_to_internet_ind,display_start_date,bid_date,bid_status _code,pre_bid_ind,bid_schedule_desc,display_end_date,"
strSQL = strSQL & "pbss_bid.add_id,pbss_bid.add_date,pbss_bid.update_id,pbss_bid.update_date,"
strSQL = strSQL & "pbss_bid_schedule.add_id,pbss_bid_schedule.add_date,pbss_bid_schedule.update_id,pbss_bid_schedule.up date_date"
strSQL = strSQL & " from pbss.pbss_bid, pbss.pbss_bid_schedule WHERE pbss_bid.bid_id ='" & BidId & "'"
strSQL = strSQL & " and pbss_bid_schedule.bid_id ='" & BidId & "' and pre_bid_ind = 0"
Dim objConnection As New OleDbConnection(strConnection)
Dim objCommand As New OleDbCommand(strSQL, objConnection)
Dim objDataReader As OleDbDataReader
Try
objConnection.Open()
objDataReader = objCommand.ExecuteReader
Do While objDataReader.Read = True
txtBidId.Text = objDataReader("Bid_ID")

hope this helps...good luck

0 comments:

Post a Comment