
darenkov
Members-
Posts
8 -
Joined
-
Last visited
About darenkov
- Birthday 06/08/1977
Personal Information
-
Occupation
Web developer
-
Visual Studio .NET Version
VS Pro 2003
-
.NET Preferred Language
VB.NET
darenkov's Achievements
Newbie (1/14)
0
Reputation
-
Hi, I am a vb.net newbie and have been asked by my boss to create a small app that will allow him to select a file and have it copied to a different location. I am not sure which common dialog to use?! I notice there is one for opening files but I don't want to actually open the file, I just want to allow him to select it and press "OK", and then to select a different location where he wants to move it to. Does anyone have any suggestions? Should I perhaps be using a treeview control instead? cheers
-
extract Sproc output Parm from dataset?!
darenkov replied to darenkov's topic in Database / XML / Reporting
Thanks mate. :) -
Hi, I have created a dataset which is populated with the results from my Stored Procedure and then bound to my datalist. Everything works fine but I am not sure how to get the Ouput Paramater back from my SPROC through my dataset or otherwise. I know it can be done with the command.executenonquery method but I am not using that as I am just using the fill method of the dataset to get my results. Is there anyway I can pull this out through my dataset or a different method (other than command.executenonquery ? Here is the relevant block of code containing the name of the output parameter: ------------------------------------------------------------ cmd.Parameters.Add("@FullCount", SqlDbType.Int) cmd.Parameters("@FullCount").Direction = ParameterDirection.Output Dim adapter As New SqlDataAdapter(cmd) Dim ds As New DataSet() adapter.Fill(ds) ListResults.DataSource = ds.Tables(0).DefaultView ListResults.DataBind() How can I get the @FullCount parameter into a variable? cheers
-
Hi I have been trying to populate a dataset (that binds to a datalist) via a stored procedure. The stored procedure works well on its own, but when I run my .net code to display the records the page comes up empty. It loads but doesn't show any records! I have tested the rowcount on the table and it is coming back as zero. The problem is I can't see anything in my code which looks out of place. I need a fresh pair of eyes to look over it. Anyone got any ideas? I have pasted the logic for the Sproc and the ASP.NET below: ASP.NET: Dim MyConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim cmd As New SqlCommand("uspSearch", MyConnection) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add("@suburbtown", SqlDbType.Varchar, 30) cmd.Parameters("@suburbtown").Direction = ParameterDirection.Input cmd.Parameters("@suburbtown").Value = "NULL" cmd.Parameters.Add("@accountant_type", SqlDbType.Int) cmd.Parameters("@accountant_type").Direction = ParameterDirection.Input cmd.Parameters("@accountant_type").Value = 1 cmd.Parameters.Add("@keyword", SqlDbType.Varchar, 25) cmd.Parameters("@keyword").Direction = ParameterDirection.Input cmd.Parameters("@keyword").Value = "NULL" cmd.Parameters.Add("@state", SqlDbType.Varchar, 3) cmd.Parameters("@state").Direction = ParameterDirection.Input cmd.Parameters("@state").Value = "NULL" cmd.Parameters.Add("@PageSize", SqlDbType.Int) cmd.Parameters("@PageSize").Direction = ParameterDirection.Input cmd.Parameters("@PageSize").Value = 10 cmd.Parameters.Add("@CurrentPage", SqlDbType.Int) cmd.Parameters("@CurrentPage").Direction = ParameterDirection.Input cmd.Parameters("@CurrentPage").Value = 1 cmd.Parameters.Add("@FullCount", SqlDbType.Int) cmd.Parameters("@FullCount").Direction = ParameterDirection.Output Dim adapter As New SqlDataAdapter(cmd) Dim ds As New DataSet() adapter.Fill(ds) ListResults.DataSource = ds.Tables(0).DefaultView ListResults.DataBind() --------------------------- SPROC (Works fine) ---------------------------- CREATE PROCEDURE uspSearch( @suburbtown varchar(30) = NULL, @accountant_type int = NULL, @keyword varchar(25) = NULL, @state varchar(3) = NULL, @PageSize INT, @CurrentPage INT, @FullCount int OUTPUT ) AS BEGIN select identity(int, 1, 1) as ID, * INTO #Temp from ( SELECT DISTINCT B.business_id, B.rank, B.business_name, B.suburb_town, B.postcode, B.phone, B.fax, B.status, BF.description FROM BUSINESS B LEFT JOIN BUSINESSFULL BF ON B.business_id = BF.business_id LEFT JOIN SERVICESOFFERED SO on B.business_id = SO.business_id LEFT JOIN SERVICES S on S.service_id = SO.service_id WHERE @accountant_type in(15,s.service_id) AND (BF.description like @keyword + '%' OR @keyword is NULL) AND (B.suburb_town = @suburbtown OR B.postcode = @suburbtown OR @suburbtown is NULL) AND (B.state = @state OR @state is NULL) AND (B.status >=3 ) ) t1 ORDER BY t1.RANK ASC SELECT @FullCount = count(*) FROM #Temp SELECT @FullCount = case when @FullCount % @PageSize = 0 then @FullCount/@PageSize ELSE @FullCount/@PageSize + 1 END SET rowcount @PageSize SELECT * FROM #temp WHERE ID>@PageSize*(@CurrentPage-1) SET rowcount 0 END GO
-
Hi I have been trying to populate a dataset (that binds to a datalist) via a stored procedure. The stored procedure works well on its own, but when I run my .net code to display the records the page comes up empty. It loads but doesn't show any records! I have tested the rowcount on the table and it is coming back as zero. The problem is I can't see anything in my code which looks out of place. I need a fresh pair of eyes to look over it. Anyone got any ideas? I have pasted the logic for the Sproc and the ASP.NET below: ASP.NET: Dim MyConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim cmd As New SqlCommand("uspSearch", MyConnection) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add("@suburbtown", SqlDbType.Varchar, 30) cmd.Parameters("@suburbtown").Direction = ParameterDirection.Input cmd.Parameters("@suburbtown").Value = "NULL" cmd.Parameters.Add("@accountant_type", SqlDbType.Int) cmd.Parameters("@accountant_type").Direction = ParameterDirection.Input cmd.Parameters("@accountant_type").Value = 1 cmd.Parameters.Add("@keyword", SqlDbType.Varchar, 25) cmd.Parameters("@keyword").Direction = ParameterDirection.Input cmd.Parameters("@keyword").Value = "NULL" cmd.Parameters.Add("@state", SqlDbType.Varchar, 3) cmd.Parameters("@state").Direction = ParameterDirection.Input cmd.Parameters("@state").Value = "NULL" cmd.Parameters.Add("@PageSize", SqlDbType.Int) cmd.Parameters("@PageSize").Direction = ParameterDirection.Input cmd.Parameters("@PageSize").Value = 10 cmd.Parameters.Add("@CurrentPage", SqlDbType.Int) cmd.Parameters("@CurrentPage").Direction = ParameterDirection.Input cmd.Parameters("@CurrentPage").Value = 1 cmd.Parameters.Add("@FullCount", SqlDbType.Int) cmd.Parameters("@FullCount").Direction = ParameterDirection.Output Dim adapter As New SqlDataAdapter(cmd) Dim ds As New DataSet() adapter.Fill(ds) ListResults.DataSource = ds.Tables(0).DefaultView ListResults.DataBind() --------------------------- SPROC (Works fine) ---------------------------- CREATE PROCEDURE uspSearch( @suburbtown varchar(30) = NULL, @accountant_type int = NULL, @keyword varchar(25) = NULL, @state varchar(3) = NULL, @PageSize INT, @CurrentPage INT, @FullCount int OUTPUT ) AS BEGIN select identity(int, 1, 1) as ID, * INTO #Temp from ( SELECT DISTINCT B.business_id, B.rank, B.business_name, B.suburb_town, B.postcode, B.phone, B.fax, B.status, BF.description FROM BUSINESS B LEFT JOIN BUSINESSFULL BF ON B.business_id = BF.business_id LEFT JOIN SERVICESOFFERED SO on B.business_id = SO.business_id LEFT JOIN SERVICES S on S.service_id = SO.service_id WHERE @accountant_type in(15,s.service_id) AND (BF.description like @keyword + '%' OR @keyword is NULL) AND (B.suburb_town = @suburbtown OR B.postcode = @suburbtown OR @suburbtown is NULL) AND (B.state = @state OR @state is NULL) AND (B.status >=3 ) ) t1 ORDER BY t1.RANK ASC SELECT @FullCount = count(*) FROM #Temp SELECT @FullCount = case when @FullCount % @PageSize = 0 then @FullCount/@PageSize ELSE @FullCount/@PageSize + 1 END SET rowcount @PageSize SELECT * FROM #temp WHERE ID>@PageSize*(@CurrentPage-1) SET rowcount 0 END GO
-
Hi, I have created a sproc which inserts some data and also returns the user_id via the scope_identity(). My problem is that I am not having any luck getting the return value when executing the sproc in my asp.net (vb) app. The data seems to insert fine but not the return value I want. Is anyone familiar with how this can be done using the CommandType.StoredProcedure method etc? cheers