Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Line break VB.NET

Reply
Thread Tools

Line break VB.NET

 
 
dancer
Guest
Posts: n/a
 
      07-06-2007
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>


 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      07-07-2007
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" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> 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>
>
>



 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      07-07-2007
On Jul 7, 2:29 am, "Juan T. Llibre" <(E-Mail Removed)> 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>")

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      07-07-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
On Jul 7, 2:29 am, "Juan T. Llibre" <(E-Mail Removed)> 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>")


 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      07-07-2007
On Jul 7, 2:48 pm, "Juan T. Llibre" <(E-Mail Removed)> wrote:
> I must be getting lysdexic in my advanced age.
>


it happens to me all the time, never mind

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read a file line by line and write each line to a file based on the5th byte scad C++ 23 05-17-2009 06:11 PM
`if (!p ? i++ : 0) break;' == `if (!p){ i++; break;}' ? lovecreatesbea...@gmail.com C Programming 12 04-14-2008 07:59 AM
How to read a text file line by line and remove some line kaushikshome C++ 4 09-10-2006 10:12 PM
Beginner: read $array with line breaks line by line Marek Stepanek Perl Misc 12 09-02-2006 10:27 AM
Read a file line by line with a maximum number of characters per line Hugo Java 10 10-18-2004 11:42 AM



Advertisments