|
老師您好~ 我是照著"挑戰asp.net2.0 for vb"這本書來做會員子系統! 頁面都拉好了~但是在於"申請加入會員(memberAdd)"後,應該是會繼續連到"填寫基本資料的地方(memberAdd1)",但再執行後是可以註冊的,不過按了"繼續"鍵後就不會跳出填寫資料的介面。 不知道是哪裡出了問題,我都有照書本上做! 而加了程式碼後都會出現問題! *由於我們是用sql資料庫,所以不之路徑會不會有問題!
以下是我的程式碼: Protected Sub Page_PreRender(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.PreRender lblUser.Text = Context.User.Identity.Name & " 個人資料" Dim user As MembershipUser user = Membership.GetUser(Context.User.Identity.Name) Dim email As String = user.Email Dim ads As New SqlDataSource("~/App_data/member.mdf", "") ads.InsertCommand = "Insert into memberData (m_username, m_sex, m_email, m_birthday, m_real) VALUES ('" & Context.User.Identity.Name & "', 'm', '" & email & "', '1980/1/1', false)" ads.Insert() *這邊有問題* End Sub ----------------------------- Protected Sub SqlDataSource1_Updated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Updated Response.Redirect("member\memberZone.aspx") End Sub ----------------------------- Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload Dim ads As New SqlDataSource("~/App_data/member.mdf", "") ads.SelectCommand = "Select * From memberData Order By m_id DESC" Dim dv As Data.DataView = ads.Select(New DataSourceSelectArguments)*這一行有問題* Dim id As Integer = dv.Item(0).Item("m_id") Dim newdate As String = FormatDateTime(dv.Item(0).Item("m_birthday"), DateFormat.ShortDate) ads.UpdateCommand = "Update memberData Set m_birthday='" & newdate & "' Where m_id=" & id ads.Update() End Sub End Class
|