M
Miro
I created a accessdatasource on my form and it has a parameter for the
insert command.
Then a button to "insert data".
The only way I have found to use that parameter for insert is to use the
..defaultvalue
This seems funny to me.
Instead of doing this:
AccessDataSource1.InsertParameters("AnotherValue").DefaultValue =
TextBox1.Text
AccessDataSource1.Insert()
I was looking to do sometihng like this:
AccessDataSource1.InsertParameters("AnotherValue") = TextBox1.Text
AccessDataSource1.Insert()
or can I only use default value - is that how it is done?
Thanks
Miro
====Code below of control and button ====
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/mydata.mdb"
DeleteCommand="DELETE FROM [MyFirstTable] WHERE [ID] = ?"
InsertCommand="INSERT INTO [MyFirstTable] ([AnotherValue])
VALUES ( ?)"
SelectCommand="SELECT [ID], [AnotherValue] FROM [MyFirstTable]"
UpdateCommand="UPDATE [MyFirstTable] SET [AnotherValue] = ?
WHERE [ID] = ?">
<DeleteParameters>
<asparameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="AnotherValue" Type="String" />
<asparameter Name="ID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="AnotherValue" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
AccessDataSource1.InsertParameters("AnotherValue").DefaultValue =
TextBox1.Text
AccessDataSource1.Insert()
End Sub
insert command.
Then a button to "insert data".
The only way I have found to use that parameter for insert is to use the
..defaultvalue
This seems funny to me.
Instead of doing this:
AccessDataSource1.InsertParameters("AnotherValue").DefaultValue =
TextBox1.Text
AccessDataSource1.Insert()
I was looking to do sometihng like this:
AccessDataSource1.InsertParameters("AnotherValue") = TextBox1.Text
AccessDataSource1.Insert()
or can I only use default value - is that how it is done?
Thanks
Miro
====Code below of control and button ====
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/mydata.mdb"
DeleteCommand="DELETE FROM [MyFirstTable] WHERE [ID] = ?"
InsertCommand="INSERT INTO [MyFirstTable] ([AnotherValue])
VALUES ( ?)"
SelectCommand="SELECT [ID], [AnotherValue] FROM [MyFirstTable]"
UpdateCommand="UPDATE [MyFirstTable] SET [AnotherValue] = ?
WHERE [ID] = ?">
<DeleteParameters>
<asparameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="AnotherValue" Type="String" />
<asparameter Name="ID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="AnotherValue" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
AccessDataSource1.InsertParameters("AnotherValue").DefaultValue =
TextBox1.Text
AccessDataSource1.Insert()
End Sub