Good day, I have found a few examples that are close to what I want, such as Execute a SQL Stored Procedure and process the results however I am just struggling to see the wood for the trees on this one...
I have an SQL database & a stored procedure within there that has a variable @ModuleName
I want a user to type text into a text box and click search. When search is clicked the word typed into the search box is passed into @ModuleName i.e. Searchtext.txt = @ModuleName
This is then passed off to the StoredProcedure and used to create the SQL for Gridview called GridView1.
I have tried alot of techniques and am clearly missing something
Stored Procedure
ALTER PROCEDURE [dbo].[spModuleID]
@ModuleName char(50)
AS
BEGIN
select * from dbo.ModuleID where [ModuleName] = @ModuleName ORDER BY [ModuleName]
END
Gridview1 links to SQL like this..
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True"
DataKeyNames="ModuleID">
<Columns>
<asp:BoundField DataField="ModuleID" HeaderText="ModuleID" ReadOnly="True"
SortExpression="ModuleID" />
<asp:BoundField DataField="ModuleName" HeaderText="ModuleName"
SortExpression="ModuleName" />
</Columns>
</asp:GridView>
I have some code under the searhc button now that hopefulyli s heading the right way...
Protected Sub Search(sender As Object, e As System.EventArgs) Handles btnSearch.Click
Dim myds As New DataSet1
MyConnection.ConnectionString = LearnConnectionString
Dim disp As New SqlDataAdapter("spModuleName", MyConnection)
disp.Fill(myds, "dev_display")
'Below wants to be a datagrid
txtDisplay.Text = myds.Tables("dev_display").Rows(0).Item("knownsoft")
myds.Dispose()
End Sub