从sql数据库中获取单个值(asp.net)(Getting out a single value from a sql database (asp.net))

编程入门 行业动态 更新时间:2024-10-23 04:50:05
从sql数据库中获取单个值(asp.net)(Getting out a single value from a sql database (asp.net))

我正在尝试从数据库中的表中获取单个值。 存储时,它们都被赋予唯一的ID。 这是我用来放入的代码:

With SqlDataSource1 .InsertParameters("page").DefaultValue = ViewState("TrueURL") If My.User.IsAuthenticated Then .InsertParameters("sender").DefaultValue = My.User.Name Else .InsertParameters("sender").DefaultValue = Request.UserHostAddress.ToString End If .InsertParameters("details").DefaultValue = PrepareText(TextBox2.Text) .InsertParameters("date").DefaultValue = Now() .Insert() End With

这样你就可以了解我在寻找什么,我不是在寻找sql语句,我不知道如何使用它们。

请记住,这都是vb.net/asp.net。

谢谢!

- 编辑 -

我想我找到了一些有用的东西,但我找不到如何使用它。 选择功能。 它返回一些东西,并接受像我上面提到的插入参数......任何想法?

I'm trying to get a single value from my table in a database. They are all given a unique id when stored. Here is the code I use to put the in:

With SqlDataSource1 .InsertParameters("page").DefaultValue = ViewState("TrueURL") If My.User.IsAuthenticated Then .InsertParameters("sender").DefaultValue = My.User.Name Else .InsertParameters("sender").DefaultValue = Request.UserHostAddress.ToString End If .InsertParameters("details").DefaultValue = PrepareText(TextBox2.Text) .InsertParameters("date").DefaultValue = Now() .Insert() End With

That was so you could get an idea of what I was looking for, I'm not looking for sql statements, I don't know how to use them.

Just keep in mind, this is all vb.net/asp.net.

Thanks!

--EDIT--

I think I found something useful but I can't find how to use it. The Select function. It returns something and accepts parameters like the insert one I mentioned above... any ideas?

最满意答案

如果没有先运行SQL查询来提取它,就无法提取它。

如果您已经掌握了这一点,请在MS帮助页面中进一步了解如何运行选择查询,这是您放置SQL语句的地方。

You cant extract it without first running an SQL query to extract it.

If you've got this far, read a little further in the MS help pages about how to run the select querys, this is where you would put your SQL statements.

更多推荐

本文发布于:2023-08-07 09:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1463788.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库中   asp   sql   database   single

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!