|
Hello Everyone
This is Shakeer Baig from India. I am a Programmer in C#.Net. I would like to develop a application which consists more of Notepad more of Wordpad more of Mspaint more of Alarm CLock more of Games more of PDF files more of Scientific Calculator all into one single application which is more helpful for the future Mankind and i do not know a source code for how to retrieve a image from a Sql Database Even if i get the Image not the desired. So pls kindly share your views with me.
Thanks and Regards
Shakeer Baig.
|
|
|
|
|
I suggest you start with some less ambitious goals; study a couple of books, read some articles here on CodeProject, and then try some small apps first.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
sshakeerbaig wrote: I would like to develop a application which consists more of Notepad more of Wordpad more of Mspaint more of Alarm CLock more of Games more of PDF files more of Scientific Calculator all into one single application which is more helpful for the future Mankind and i do not know a source code for how to retrieve a image from a Sql Database Even if i get the Image not the desired. So pls kindly share your views with me.
Bad question.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
sshakeerbaig wrote: helpful for the future Mankind
Don't breed.
|
|
|
|
|
A few more features and it could well become an OS. But wait...an OS written in .Net!!!
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hello!
Some of the images I try to embedd do not show up in my email, but are instead sent as attachments. I can´t figure out why some are working and some arent. This is how I embedd images:
MailMessage mail = new MailMessage();<br />
<br />
string imagePath = System.Windows.Forms.Application.StartupPath + "\\pathToImages";<br />
<br />
LinkedResource resource1 = new LinkedResource(imagePath + "\\head21.jpg", <br />
System.Net.Mime.MediaTypeNames.Image.Jpeg);<br />
resource1.ContentId = "head21.jpg";<br />
<br />
LinkedResource resource2 = new LinkedResource(imagePath + "\\border.jpg", <br />
System.Net.Mime.MediaTypeNames.Image.Jpeg);<br />
resource2.ContentId = "border.jpg";<br />
<br />
StringBuilder content = new StringBuilder();<br />
<br />
....<br />
<br />
content.Append(string.Format("<td width=600 align=left><img border=0 align=center src=\"cid:head21.jpg\" width=600 height=57></td></tr></tbody></table></td></tr></tbody></table>"));<br />
<br />
..<br />
<br />
content.Append(string.Format("<td><img alt=\"\" src=\"cid:border.jpg\" width=560 height=21></td></tr></tbody></table></td>"));<br />
<br />
..<br />
<br />
string body = Mail.CreateHtmlFromTemplate(content.ToString(), string.Empty, null);<br />
<br />
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(body, null, MediaTypeNames.Text.Html);<br />
<br />
htmlView.LinkedResources.Add(resource1);<br />
htmlView.LinkedResources.Add(resource2);
Here resource1 works fine, and shows up in body of email. Resource2 is instead sent as attachment and does not show up in the email. Does anyone have any idea why this is?
|
|
|
|
|
Neat, you can do that?
My guess is that it may have something to do with the html?
How about if you don't do any of the table stuff, and just put the images inline? Does that work??
I've always found coding tables in HTML as tricky. It's easy to miss something. And, depending on the browser, the browser may or may not "fix" some html coding errors.
__________
Joe
|
|
|
|
|
Thanks for your response!
I tried just having the faulty image in a div instead, but it didn´t work
EDIT: My mistake u were absolutely right. There wasnt enough room for the image, thats why it was sent as an attachment. Thanks alot!
modified on Tuesday, August 18, 2009 4:37 AM
|
|
|
|
|
Cool! I'm glad that you found the problem!
I've always found tables to be a pain in HTML.
___________
Joe
|
|
|
|
|
try
{
this.bioSecureDataSet.Login.Rows.Remove(loginrow);
this.loginTableAdapter.Update(this.bioSecureDataSet.Login);
this.bioSecureDataSet.Employee.Rows.Remove(employeerow);
this.employeeTableAdapter.Update(this.bioSecureDataSet.Employee);
}
catch (OleDbException)
{
MessageBox.Show("Database Error");
return;
}
I have a form which enables me to scroll and view through each individual staff's particulars. then i would have a remove button if i want to remove that staff and his/her particulars data row from the database table. but i keep getting this error "The given DataRow is not in the current DataRowCollection". Help?
|
|
|
|
|
I'm not 100% up on data sets, but I think the following are likely to cause your problem:
1. loginrow or employeerow have already been deleted from the datarow collection.
2. The table adapter is empty.
3. (Especially likely in a postback on a ASP.net site) The instance of the row you are providing is not the same as the one in the Table adapter.
Can you provide more debug / implementation info (e.g. what type of form is it)?
|
|
|
|
|
BioSecureDataSet.EmployeeRow employeerow = ??;
BioSecureDataSet.LoginRow loginrow = ??;
this.bioSecureDataSet.Login.Rows.Remove(loginrow);
this.loginTableAdapter.Update(this.bioSecureDataSet.Login);
this.bioSecureDataSet.Employee.Rows.Remove(employeerow);
this.employeeTableAdapter.Update(this.bioSecureDataSet.Employee);
I'm sure i have to define the loginrow and employeerow.
but i don't know what to define them as? I just want it to be the current information(data row) that it is showing..
|
|
|
|
|
Let's pretend Login has a string property "Id" as the primary key. Your code will might look like
BioSecureDataSet.EmployeeRow FindEmployeeRow(string id)
{
return this.bioSecureDataSet.Login.Rows.Find(id);
}
void YourMethod(string loginId, )
{
BioSecureDataSet.EmployeeRow employeerow = FindEmployeeRow(loginId);
}
Note that the exact implementation depends upon the primary key on your data set!
|
|
|
|
|
Remove method of DataRowCollection removes the data from DataTable not from the database.
To remove to row both from DataSet and your DB using DBDataAdapters you should call DataRow.Delete() into your case:
<br />
loginrow.Delete();<br />
this.loginTableAdapter.Update(this.bioSecureDataSet.Login);<br />
Life is a stage and we are all actors!
|
|
|
|
|
hmmm. i got the error "Object reference not set to an instance of an object."
|
|
|
|
|
And where exactly it occurred?
Life is a stage and we are all actors!
|
|
|
|
|
loginrow.Delete();
It say Null Reference Exception was Unhandled.
|
|
|
|
|
That means that loginrow is null instance.How you get it from? Do you have DbCommandBuilder linked with your DbDataAdapter?Do you have any primary/unique keys defined into the underlying table?
Life is a stage and we are all actors!
|
|
|
|
|
BioSecureDataSet.LoginRow loginrow; ?
yes, i have DbCommandBuilder linked with my DbDataAdapter. and yes i have a primary keys defined (if you must know it's employeeID).
omg, i'm bad at this.
|
|
|
|
|
You need to set the login row to something. To work, it needs to be a row in your dataset,
did you try the find method I posted earlier
e.g.
BioSecureDataSet.LoginRow loginrow;
becomes
BioSecureDataSet.LoginRow loginrow = FindEmployeeRow(employeeId)
Where the FindEmployeeRow(employeeId) calls the method I posted earlier.
Assuming you don't know which row index you are working with!
|
|
|
|
|
I hope now he/she has solved the problem.
Life is a stage and we are all actors!
|
|
|
|
|
Me Too!
|
|
|
|
|
do i really need to use the find method?
because i am able to go through the information(of staff) row by row; which is by dragging the datasource out.
i just need to delete the row which is currently shown.
|
|
|
|
|
hi all,
is it possible to convert an aspx page to PDF file?
for example, i have default.aspx page in that user will key in some info.
at the end if he clicks on convert to pdf button, the whole page should have to convert to PDF and
have to store somewhere
|
|
|
|
|
anithasalavadi wrote: is it possible to convert an aspx page to PDF file?
Yes, you can put it's output in a PDF. Easiest solution would be to print to PDF[^]
|
|
|
|