15,744,500 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Javascript questions
View C++ questions
View Python questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Edward Mergel (Top 8 by date)
Edward Mergel
22-Sep-17 3:00am
View
Thank you, and yes I backup at a set frequency
Edward Mergel
6-Sep-17 8:11am
View
Thank you works great now
Edward Mergel
3-Sep-17 16:30pm
View
Sorry if I was a little rude, had been up for 2 days and finally took my medicine. the (0)(0) was because when a member registers they are suppose to get 1 point, and I found it was not giving that point. The reason for that is it populates the new member into the points table. I fixed that and the (0)(0) error went away.
However my original problem I was trying to find a code sample or if someone could show me why I have to have my name or a name (fake) in the: Session("member") = "" (does not publish) Session("member") = "fake name" , (publishes as fake name). I need it to publish the "MemberName" based on the member doing the publishing.
Example of db TABLE Question
Column 1: memQuestion (header) Why does the plant grow green?
Column 2: qPostedBymem (header) Charles Smith (MemberName field)
Column 3: qAnswer (header) Because plants don't see the color green
Column 4: qAnswerBymem (header) fake name (MemberName)
Column 5: qAnswerDate (header) 09/03/20017
Column 4 is the problem. Fake name does not appear in the "Member" table in the database. The relationship is set. Damn thing for the likes of me I don't see an answer.
Edward Mergel
3-Sep-17 12:27pm
View
I did get the point part fixed. I found that it dealt with the registering of the member. and now the member points are solved.
Edward Mergel
3-Sep-17 12:24pm
View
Not even on subject. I asked for help with the member name being posted. Every post is worth 1 point and every answer is worth 2 points. So please let me code as I am ans just answer the question.
Edward Mergel
23-Aug-17 21:34pm
View
thank you
Edward Mergel
3-Aug-17 2:01am
View
Here is the rest of the page sorry:
' create bitmap with same size of Actual image
Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(bitmapimage)
'Creates a System.Drawing.Color structure from the four ARGB component
'(alpha, red, green, and blue) values. Although this method allows a 32-bit value
' to be passed for each component, the value of each component is limited to 8 bits.
'create Brush
Dim brush As New SolidBrush(Color.FromArgb(113, 255, 255, 255))
x = 10
y = objImage.Height / 2
'Adding watermark text on image
'g.DrawRectangle(Pens.Blue, x, y)
'g.Clear(Color.Green)
g.TextRenderingHint = Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit
g.DrawString(cf.websitename, New Font("Arial", 18, System.Drawing.FontStyle.Bold), brush, x, y)
g.DrawString(cf.websitename, New Font("Arial", 18, System.Drawing.FontStyle.Bold), brush, 100, y + 80)
'save image with Watermark image/picture
'bitmapimage.Save("watermark-image.jpg"); //if u want to save image
Response.ContentType = "image/jpeg"
bitmapimage.Save(filecopy)
bitmapimage.Dispose()
objImage.Dispose()
File.Delete(SaveLocation)
Label1.Text = "Photo Uploaded"
Else
'Response.Write("file is not an image")
Response.Write("file is " & FileUpload1.PostedFile.ContentType)
End If
Response.Write("Error: " & Exc.Message)
Finally
End Try
Else
Response.Write("Please select a file to upload.")
End If
cn.Close()
End Sub
Function addentry(ByVal ext1 As String) As String
Dim uid As String = ""
Dim strfield As String = ""
Dim strvalues As String = ""
Dim strsql As String = ""
Dim passw As String = ""
Dim cnstring As String
Dim cn As New System.Data.OleDb.OleDbConnection
Dim cmd As New System.Data.OleDb.OleDbCommand
Dim cmd2 As New System.Data.OleDb.OleDbCommand
Dim photoid As String = ""
Dim photoname As String = ""
Dim myreader As System.Data.OleDb.OleDbDataReader
cn.ConnectionString = cf.friendshipdb
cn.Open()
strsql = "select passw from photo where pid='" & Session("pid") & "' and (passw<>'' and passw is not null)"
cmd2.Connection = cn
cmd2.CommandText = strsql
myreader = cmd2.ExecuteReader
While myreader.Read
passw = myreader.GetValue(0).ToString
End While
cnstring = ConfigurationManager.ConnectionStrings("accessconstr").ConnectionString
cn.ConnectionString = cnstring
uid = Now.Year.ToString & Now.Month.ToString & Now.Day.ToString & Now.Hour.ToString & Now.Minute.ToString & Now.Millisecond
strfield = " insert into photo(photoid,photoname,pid,passw)"
strvalues = " values(@photoid,@photoname,@pid,@passw)"
strsql = strfield & strvalues
cmd.Parameters.AddWithValue("@photoid", uid)
cmd.Parameters.AddWithValue("@photoname", uid & ext1)
cmd.Parameters.AddWithValue("@pid", Session("pid"))
cmd.Parameters.AddWithValue("@passw", passw)
cmd.Connection = cn
cmd.CommandText = strsql
cmd.ExecuteNonQuery()
addentry = uid
cn.Close()
End Function
End Class
Edward Mergel
3-Aug-17 1:59am
View
Okay, the connection string issue has been resolved, but not when I try to upload I am getting no results and the image I am trying to upload is not uploading and also not writing to the MS DB. I have not done the using yet I am still reading on the, so could that be the problem? Here the the code as it looks now:
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.IO
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
Partial Class members_uploadphoto
Inherits System.Web.UI.Page
Dim cf As New comonfunctions
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Response.Write(Now.Year.ToString & Now.Month.ToString & Now.Day.ToString & Now.Hour.ToString & Now.Minute.ToString & Now.Millisecond)
Dim myreader As System.Data.OleDb.OleDbDataReader
Dim cn As New System.Data.OleDb.OleDbConnection
Dim cmd As New System.Data.OleDb.OleDbCommand
Dim strsql As String = ""
Dim mcount As Integer = 0
strsql = "select count(*) from photo where pid='" & Session("pid") & "'"
cn.ConnectionString = cf.friendshipdb
cn.Open()
cmd.Connection = cn
cmd.CommandText = strsql
myreader = cmd.ExecuteReader
If myreader.HasRows = True Then
While myreader.Read
mcount = myreader.GetValue(0)
End While
End If
If mcount >= 200 Then
upimage.Text = "You Can only Upload 200 Photos"
upimage.Enabled = False
End If
cn.Close()
End Sub
Protected Sub upimage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles upimage.Click
Dim msg As String = ""
Dim filecopy As String = ""
Dim x As Integer = 0
Dim y As Integer = 0
Dim cn As New System.Data.OleDb.OleDbConnection
Dim cmd As New System.Data.OleDb.OleDbCommand
cn.ConnectionString = cf.friendshipdb
cn.Open()
cmd.Connection = cn
If Not FileUpload1.PostedFile Is Nothing And FileUpload1.PostedFile.ContentLength > 0 Then
'Dim fn As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)
Dim ext As String = ""
ext = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)
Dim SaveLocation As String = Server.MapPath("..\App_Themes") & "\"
Try
Catch Exc As Exception
If (FileUpload1.PostedFile.ContentType = "image/gif" Or FileUpload1.PostedFile.ContentType = "image/pjpeg" Or FileUpload1.PostedFile.ContentType = "image/jpeg" Or FileUpload1.PostedFile.ContentType = "image/png" Or FileUpload1.PostedFile.ContentType = "image/bmp" Or FileUpload1.PostedFile.ContentType = "image/bitmap" Or FileUpload1.PostedFile.ContentType = "image/jpg" Or FileUpload1.PostedFile.ContentType = "image/tiff") Then
msg = addentry(ext)
SaveLocation = SaveLocation & msg & "11" & ext
filecopy = Server.MapPath("..\App_Themes") & "\" & msg & ext
FileUpload1.PostedFile.SaveAs(SaveLocation)
' watermark(SaveLocation, "aminnn")
' Response.Write("The file has been uploaded.")
Dim objImage As System.Drawing.Image = System.Drawing.Image.FromFile(SaveLocation)
'From File
Dim height As Integer = objImage.Height
'Actual image width
Dim width As Integer = objImage.Width
'Actual image height
Dim bitmapimage As New System.Drawing.Bitmap(objImage, width, height)
' create bitmap with same size of Actual image
Show More