I'm having probelms trying to write text to an image coming from a database. I
started this using the article on this site but the majority of all articles on
asp.net use C# and I'm using VB.
[url]http://www.macromedia.com/devnet/mx/dreamweaver/articles/graphing_aspnet_04.html[/url]
Anyway this is my code. <%@ Page Language='VB' ContentType='Image/Gif'
debug='true' %> <%@ Register TagPrefix='MM' Namespace='DreamweaverCtrls'
Assembly='DreamweaverCtrls,version=1.0.0.0,publicK eyToken=836f606ede05d46a,cultu
re=neutral' %> <%@ import namespace='system.drawing' %> <%@ import
namespace='system.drawing.imaging' %> <%@ import
namespace='system.drawing.drawing2d' %> <script runat='server'> Dim ds as
Dataset Sub Page_Init(Src As Object, E As EventArgs) Dim connectionstring AS
string= 'Persist Security Info=False;Data Source=SQLserver;Initial
Catalog=FacultyandStaffDir;User ID=UserName;Password=passwd;' 'Initialize
your MM: DataSet object ds = new DataSet() ds.ConnectionString =
connectionstring ds.CommandText = 'SELECT dbo.tblPersonnel.personID,
dbo.tblPersonnel.TypeID, dbo.tblPersonnel.Room, dbo.tblPersonnel.Phone,
dbo.tblPersonnel.Ext, dbo.tblPersonnel.Title, dbo.tblPersonnel.Salutation,
dbo.tblPersonnel.LastName, dbo.tblPersonnel.FirstName,
dbo.tblPersonnel.MiddleInitial, dbo.tblPersonnel.EmailAddress,
dbo.tblPersonnel.HomepageAddress,dbo.tblPersonnel. Picture,
dbo.tblPersonnel.deptListID, dbo.tblPersonnel.DegreeInfo,
dbo.tbldeptList.deptListID, dbo.tbldeptList.Department, dbo.tbldeptList.Phone,
dbo.tbldeptList.Room FROM dbo.tblPersonnel, dbo.tbldeptList'
ds.ProcessOnPostBack = false 'hook into the page event model
Me.Controls.Add(ds) End Sub Sub Page_PreRender(Src As Object, E As EventArgs)
' initialise objects dim b as New system.drawing.bitmap(200, 50,
pixelformat.Format24bppRgb) ' dim b as New system.drawing.bitmap(200, 50,
pixelformat.Format16bppRgb555) dim salign as New system.drawing.stringformat
dim g as graphics = graphics.fromimage(b) dim emailstr as String =
ds.RecordCount 'Tables(0).Rows(0)('PersonID') g.clear(color.white) ' blank
the image ' g.smoothingMode = smoothingMode.antiAlias ' antialias objects
'g.FillRectangle(New linearGradientBrush(New point(0,0), New
point(b.width,b.height),
color.fromArgb(255,255,255,255),color.fromArgb(100 ,100,100,100)),0,0,b.width,b.h
eight) ' shadow text salign.alignment = stringalignment.center
g.drawString(emailstr, New font('verdana
black',10,fontstyle.regular),Brushes.black, 100,25, salign) ' centered
text salign.alignment = stringalignment.center ' Set the content type
response.contenttype='image/gif' ' send the image to the viewer
b.save(response.outputstream, imageformat.gif) ' tidy up b.dispose()
End Sub </script> For some reason the Dataset is not retrieving any records
dim emailstr as String = ds.RecordCount I'm not really looking for the record
count I want to put emailAddress in that variable but for testing I;m using
recordcount and for some reason I'm not getting any thing returned. If anyone
has any ideas I would appreciate it. When I was creating the dataset the normal
way is appeared as though I was getting the correct data of odd characters but
it was not rendering them as an image now I'm not able to get the dataset after
I moved it into the Page_Init portion of the page as the article suggests.