473,385 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Return value instead of databinding ?

hello!

how can i return this value to a varible instead of bind it to a gridview

Me.GridView2.DataSource = Me.SqlDataSource1

Me.SqlDataSource1.SelectCommand = "SELECT [Anvandare_Fornamn] FROM
[WebappOrders_Mailbox] WHERE [AnvandareUserid] = " & "'" & anvid & "'"

Me.GridView2.DataBind()

/ kind.... Lelle
Nov 19 '05 #1
3 1100
Hi

I don't know if you are using OLDEB or SQL but it doesn't really matter
except you have to choose the right object for your solution.

Use an Oledbcommand (or sqlcommand) and then use the "ExecuteScalar"

Asuming you have a myConnection object already.. here's an example

Dim myCommand As New SqlCommand("SELECT [Anvandare_Fornamn] FROM
[WebappOrders_Mailbox] WHERE [AnvandareUserid] = " & "'" & anvid & "'",
myConnection)

Dim myVariable As String

myConnection.Open()

myVariable = myCommand.ExecuteScalar

myConnection.Close()

Best Regards/

Lars Netzel

"Lelle" <sv****@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP14.phx.gbl...
hello!

how can i return this value to a varible instead of bind it to a gridview

Me.GridView2.DataSource = Me.SqlDataSource1

Me.SqlDataSource1.SelectCommand = "SELECT [Anvandare_Fornamn] FROM
[WebappOrders_Mailbox] WHERE [AnvandareUserid] = " & "'" & anvid & "'"

Me.GridView2.DataBind()

/ kind.... Lelle

Nov 19 '05 #2
thanks for you answer. i forgot to tell that this is asp.net 2.0 and
i have used the design view in VS2005 to create a sqlsource.

now i want to programmatically manipulate the output from this sqlsource
"Lars Netzel" <ui****@adf.se> skrev i meddelandet
news:OB**************@TK2MSFTNGP10.phx.gbl...
Hi

I don't know if you are using OLDEB or SQL but it doesn't really matter
except you have to choose the right object for your solution.

Use an Oledbcommand (or sqlcommand) and then use the "ExecuteScalar"

Asuming you have a myConnection object already.. here's an example

Dim myCommand As New SqlCommand("SELECT [Anvandare_Fornamn] FROM
[WebappOrders_Mailbox] WHERE [AnvandareUserid] = " & "'" & anvid & "'",
myConnection)

Dim myVariable As String

myConnection.Open()

myVariable = myCommand.ExecuteScalar

myConnection.Close()

Best Regards/

Lars Netzel

"Lelle" <sv****@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP14.phx.gbl...
hello!

how can i return this value to a varible instead of bind it to a gridview

Me.GridView2.DataSource = Me.SqlDataSource1

Me.SqlDataSource1.SelectCommand = "SELECT [Anvandare_Fornamn] FROM
[WebappOrders_Mailbox] WHERE [AnvandareUserid] = " & "'" & anvid & "'"

Me.GridView2.DataBind()

/ kind.... Lelle


Nov 19 '05 #3
ok, I haven't touched the 2.0 after it totally crashed my computer ( i guess
having VS.NET 2003 and the 2.0 beta was not a good idea.. so I don't think
I can help you more.

But After ALWAYS having problems with graphically "automatic-click-and-Drop"
wizard objects made in Visual Studio I now always prefer to do this things
maually.

best regards
/Lars Netzel
"Lelle" <sv****@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
thanks for you answer. i forgot to tell that this is asp.net 2.0 and
i have used the design view in VS2005 to create a sqlsource.

now i want to programmatically manipulate the output from this sqlsource
"Lars Netzel" <ui****@adf.se> skrev i meddelandet
news:OB**************@TK2MSFTNGP10.phx.gbl...
Hi

I don't know if you are using OLDEB or SQL but it doesn't really matter
except you have to choose the right object for your solution.

Use an Oledbcommand (or sqlcommand) and then use the "ExecuteScalar"

Asuming you have a myConnection object already.. here's an example

Dim myCommand As New SqlCommand("SELECT [Anvandare_Fornamn] FROM
[WebappOrders_Mailbox] WHERE [AnvandareUserid] = " & "'" & anvid & "'",
myConnection)

Dim myVariable As String

myConnection.Open()

myVariable = myCommand.ExecuteScalar

myConnection.Close()

Best Regards/

Lars Netzel

"Lelle" <sv****@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP14.phx.gbl...
hello!

how can i return this value to a varible instead of bind it to a
gridview

Me.GridView2.DataSource = Me.SqlDataSource1

Me.SqlDataSource1.SelectCommand = "SELECT [Anvandare_Fornamn] FROM
[WebappOrders_Mailbox] WHERE [AnvandareUserid] = " & "'" & anvid & "'"

Me.GridView2.DataBind()

/ kind.... Lelle



Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Miller | last post by:
When I dynamically populate a HtmlSelect combo box, the Value property consistently fails to return the item selected, defaulting instead to the first item in the list. For example: Protected...
2
by: Martin | last post by:
Hi, Please can somebody explain how databinding is done on a checkbox list. I have the follwoing code which I would have thought was enough to databind a checkbox, but apparently not. The...
3
by: Justin Morris via DotNetMonster.com | last post by:
<asp:TextBox ID="TextBox1" runat="server" value='<%=Server.HtmlEncode (Request.Cookies("Username")("Username"))%>'/> <input name="Password" type="text" id="Password" value='<%...
0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
3
by: Leo | last post by:
OK, this is kind of a conceptual question, so bear with me... When does a Value Object or Data Transfer Object become a Business Object, if it even does at all? For instance, in J2EE we often...
7
by: Pieter | last post by:
Hi, I'm looking for a DateTimePicker that supports 100% databinding (and support null-values)... It's a shame that the normal control doesn't, but when searching on the internet, I didn't find...
1
by: CorporateCoder | last post by:
Hi, I am trying to bind the selected value of a databound dropdown box in a databound gridview control to the value being displayed in the template column the dropdown box has been added to. ...
5
by: Mike | last post by:
In ASP.NET 2.0 I have a dropdownlist populated from a sqldatasource. The dropdownlist values are successfully populated from a database table. I would like to add the value "Select Company" which...
8
by: Andy B | last post by:
I have the object property StockContract.Dictionary which is a dictionary collection of <string, stringkey/value pairs. I need to be able to retreive the keys and their values and display them on a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.