Line break VB.NET

Discussion in 'ASP .Net' started by dancer, Jul 7, 2007.

  1. dancer

    dancer Guest

    Using VB.Net and ASP.Net 1.1

    Here is a VERY simple MS Access database request.

    How can I get a line break between the name, address, & city fields when
    they are written?

    & vbCrLf _ returns an error of " End of statement expected."


    <%@ Page Language="VB" %>

    <%@ Import Namespace="System.Data.Oledb" %>

    <script runat="server">

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)


    Dim DBConnection As OledbConnection

    DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0;" & _

    "Data Source=C:\Inetpub\wwwroot\Experiment.mdb" )

    DBConnection.Open()

    Dim DBCommand As OledbCommand

    DBCommand = New OledbCommand("SELECT * FROM table1, Experiment")

    Dim SQLString AS String

    SQLString = "SELECT * FROM Table1"

    DBCommand = New OleDBCommand(SQLString, DBConnection)

    Dim DBReader AS OledbDatareader

    DBReader = DBCommand.ExecuteReader()


    While DBReader.Read()

    Response.Write("Name is " & DBReader("Name"))
    Response.Write(DBReader("Address1"))

    Response.Write(DBReader("city"))

    End While

    DBReader.Close()

    DBConnection.Close()

    End Sub

    </script>

    </head>

    <body>

    <form id="form1" runat="server">

    </form>

    </body>

    </html>
    dancer, Jul 7, 2007
    #1
    1. Advertising

  2. You don't need the ampersand. Just use :

    DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0;" _
    "Data Source=C:\Inetpub\wwwroot\Experiment.mdb" )





    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "dancer" <> wrote in message news:%...
    > Using VB.Net and ASP.Net 1.1
    >
    > Here is a VERY simple MS Access database request.
    >
    > How can I get a line break between the name, address, & city fields when they are written?
    >
    > & vbCrLf _ returns an error of " End of statement expected."
    >
    >
    > <%@ Page Language="VB" %>
    >
    > <%@ Import Namespace="System.Data.Oledb" %>
    >
    > <script runat="server">
    >
    > Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    >
    >
    > Dim DBConnection As OledbConnection
    >
    > DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0;" & _
    >
    > "Data Source=C:\Inetpub\wwwroot\Experiment.mdb" )
    >
    > DBConnection.Open()
    >
    > Dim DBCommand As OledbCommand
    >
    > DBCommand = New OledbCommand("SELECT * FROM table1, Experiment")
    >
    > Dim SQLString AS String
    >
    > SQLString = "SELECT * FROM Table1"
    >
    > DBCommand = New OleDBCommand(SQLString, DBConnection)
    >
    > Dim DBReader AS OledbDatareader
    >
    > DBReader = DBCommand.ExecuteReader()
    >
    >
    > While DBReader.Read()
    >
    > Response.Write("Name is " & DBReader("Name"))
    > Response.Write(DBReader("Address1"))
    >
    > Response.Write(DBReader("city"))
    >
    > End While
    >
    > DBReader.Close()
    >
    > DBConnection.Close()
    >
    > End Sub
    >
    > </script>
    >
    > </head>
    >
    > <body>
    >
    > <form id="form1" runat="server">
    >
    > </form>
    >
    > </body>
    >
    > </html>
    >
    >
    Juan T. Llibre, Jul 7, 2007
    #2
    1. Advertising

  3. On Jul 7, 2:29 am, "Juan T. Llibre" <> wrote:
    > You don't need the ampersand. Just use :
    >
    > DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0;" _
    > "Data Source=C:\Inetpub\wwwroot\Experiment.mdb" )
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq :http://asp.net.do/faq/
    > foros de asp.net, en español :http://asp.net.do/foros/
    > ======================================
    >


    You need the ampersand.

    Regarding line break

    Response.Write("Name is " & DBReader("Name") & "<br>")
    Response.Write(DBReader("Address1") & "<br>")
    Response.Write(DBReader("city") & "<br>")
    Alexey Smirnov, Jul 7, 2007
    #3
  4. I must be getting lysdexic in my advanced age.

    Sorry for the crossed wire.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Alexey Smirnov" <> wrote in message
    news:...
    On Jul 7, 2:29 am, "Juan T. Llibre" <> wrote:
    > You don't need the ampersand. Just use :
    >
    > DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0;" _
    > "Data Source=C:\Inetpub\wwwroot\Experiment.mdb" )
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq :http://asp.net.do/faq/
    > foros de asp.net, en español :http://asp.net.do/foros/
    > ======================================
    >


    You need the ampersand.

    Regarding line break

    Response.Write("Name is " & DBReader("Name") & "<br>")
    Response.Write(DBReader("Address1") & "<br>")
    Response.Write(DBReader("city") & "<br>")
    Juan T. Llibre, Jul 7, 2007
    #4
  5. On Jul 7, 2:48 pm, "Juan T. Llibre" <> wrote:
    > I must be getting lysdexic in my advanced age.
    >


    it happens to me all the time, never mind :)
    Alexey Smirnov, Jul 7, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hugo
    Replies:
    10
    Views:
    1,290
    Matt Humphrey
    Oct 18, 2004
  2. kaushikshome
    Replies:
    4
    Views:
    753
    kaushikshome
    Sep 10, 2006
  3. Replies:
    12
    Views:
    935
  4. scad
    Replies:
    23
    Views:
    1,141
    Alf P. Steinbach
    May 17, 2009
  5. Marek Stepanek
    Replies:
    12
    Views:
    399
    Peter J. Holzer
    Sep 2, 2006
Loading...

Share This Page