Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
When does datasource reissue a select
Message
 
 
À
20/06/2008 11:53:25
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01325539
Message ID:
01325778
Vues:
16
Can you return the SCOPE_IDENTITY() back and select the data based on it?

>Hi John, Thanks for your reply. The INSERT is working OK. I have verified that. SOmeone else helped with the error on line 6. Here's my current version.
>
>    Protected Sub cmdAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
>        Dim sql As String = "INSERT into list_members (list_ID, personID) VALUES "
>        sql += "(" & Session("CurrentList").ToString & "," & ListBox2.SelectedValue.ToString & ")"
>        SqlDataSource3.InsertCommand = sql
>        SqlDataSource3.Insert()
>        SqlDataSource3.Select(DataSourceSelectArguments.Empty)
>        ListBox3.DataBind()
>        lblOwner.Text = sql
>    End Sub
>
>
>but I still don't see the new data unless I move to a different page and then come back.
>
>>Hi Don,
>>
>>On repost, the contents should automatically be OK assuming that the Insert was successful. Try trapping the results of the Insert to ensure that it's working.
>>
>>>With a .NET webpage, if a SQLDatasource is updated programmatically, when does the SELECT become reexecuted? Say there is a button that inserts a new record. When the page reposts, the contents of the listbox remain unchanged. How do we reissue the SELECT so the contents of the listbox will be updated?
>>>
>>>
>>>    Protected Sub cmdAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
>>>        Dim sql As String = "INSERT into list_members (list_ID, personID) VALUES "
>>>        sql += "(" & Session("CurrentList").ToString & "," & ListBox2.SelectedValue.ToString & ")"
>>>        SqlDataSource3.InsertCommand = sql
>>>        SqlDataSource3.Insert()
>>>        SqlDataSource3.Select()       ' This line presents an error and may not belong
>>>        ListBox3.DataBind()
>>>    End Sub
>>>
>>>
>>>
>>>Thanks
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform