Jump to content
Fórum Script Brasil
  • 0

.net Como Fazer Um Select E Trazer O Valor,


MACUL

Question

Dim VarId As Integer = Page.Request.QueryString("par1")

       Dim connString As String = "Data Source=NOME;Initial Catalog=NOMDEDB;Persist Security Info=False;User ID=sa;Pwd='senha';Workstation ID=NOMEMAQ;Packet Size=4096"

       Dim sqlConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connString)
       sqlConn.Open()

       Dim sqlCmd As New System.Data.SqlClient.SqlCommand()

       sqlCmd.Connection = sqlConn

       sqlCmd.CommandText = "SELECT NOME " & _
       "FROM dbo.ARQUIVO WHERE (ID = @ID)"
       sqlCmd.Parameters.Add("@ID", System.Data.SqlDbType.Int).Value = VarId

       Dim drLin As System.Data.SqlClient.SqlDataReader
       drLin = sqlCmd.ExecuteReader(CommandBehavior.SequentialAccess)
       repArquivo.DataSource = drLin
       repArquivo.DataBind()
no ASP3 utilizava response.redirect(rs("NOME")) mas só vejo explicações de como utilizar banco de dados p/ apresentação na tela e no entanto quero trabalhar com a informação. como faço ? Apresentar na tela
<asp:repeater id="repArquivo" runat="server">
  <ItemTemplate>
   <%#Container.DataItem("NOME")%>
  </ItemTemplate>
 </asp:repeater>

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...