Line break VB.NET

D

dancer

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>
 
J

Juan T. Llibre

You don't need the ampersand. Just use :

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

Guest

You don't need the ampersand. Just use :

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

You need the ampersand.

Regarding line break

Response.Write("Name is " & DBReader("Name") & "<br>")
Response.Write(DBReader("Address1") & "<br>")
Response.Write(DBReader("city") & "<br>")
 
J

Juan T. Llibre

I must be getting lysdexic in my advanced age.

Sorry for the crossed wire.





You don't need the ampersand. Just use :

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

You need the ampersand.

Regarding line break

Response.Write("Name is " & DBReader("Name") & "<br>")
Response.Write(DBReader("Address1") & "<br>")
Response.Write(DBReader("city") & "<br>")
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top