|
Would you care to elaborate as to what the problem actually is? the exact error message (if any), which line, or how is it behaving and how do you expect it to behave.
Also, you said you were trying to update, but I see an InsertOnSubmit in your code...
|
|
|
|
|
Thank you Emmanuel Medina Lopez,
This is the code for saving the 'asset' details. The asset details are saving in to the table TblAsset.
public static LINQtoSQLAssetMeterDataContext dc=new LINQtoSQLAssetMeterDataContext("ConnectionString");
protected override void Save()
{
if (clsTblAsset == null) clsTblAsset = new TblAsset();
clsTblAsset.AssetConditionId = cmbAssetCondition.SelectedValue.getInteger();
clsTblAsset.SerialNo = txtSerialNo.Text.getString();
clsTblAsset.ServiceTag = txtServiceTag.Text.getString();
clsTblAsset.CostCenterId = cmbCostCenter.SelectedValue.getInteger();
clsTblAsset.AssetStatusId = cmbAssetStatus.SelectedValue.getInteger();
clsTblAsset.Description = txtDescription.Text.getString();
clsTblAsset.LocationId = cmbLocation.SelectedValue.getInteger();
clsTblAsset.AssetNo = txtAssetNo.Text.getString();
if (pictBarcode.Image != null)
clsTblAsset.BarCode = barcodePict;
if (pictAsset.Image != null)
clsTblAsset.AssetPict = assetPict;
clsTblAsset.Notes = txtNotes.Text.getString();
if (clsTblAsset.AssetId == 0)
{
clsTblAsset.StockId = ucItem._Id.getInteger();
clsTblAsset.RefId = 0;
clsTblAsset.RefModule = "S";
clsTblAsset.AssetEntryDate = DateTime.Now.Date.getDateTime();
clsTblAsset.LoginId = ClsParameters.LogInId;
dc.TblAssets.InsertOnSubmit(clsTblAsset);
}
dc.SubmitChanges();
}
If the AssetId is zero, then details are inserted to the table. and if the AssetId>0, asset details are updated to the table.
Here the problem I am facing is that,
Once if we insert in to the table, all the details are inserted properly. Once if we are editing an 'asset' data and changing the value and updating the table, The data is not get updated. But no errors or exception is occuring.
Please let me know, if any one knows it.
Regards,
Jini4
|
|
|
|
|
how to upload a song and retrieve the song from database..
please give any idea about on this....
|
|
|
|
|
1-Create database with table : tbSongs
guid | songname | songfile
----------------------------
guid uniuqeidentfieir
songname varchar(255)
songfile image
2-Convert your song to byte array
public static byte [] File2ByteArray (string szFileName)
{
Stream st = new FileStream (szFileName,FileMode.Open);
byte[] bit = new byte[st.Length];
st.Read(bit, 0 , (int)st.Length);
st.Close();
return bit;
}
3-Store it in tbSongs
#region Fields
private Guid _guid;
public Guid guid
{
get
{
return _guid;
}
set
{
_guid = value;
}
}
private string _songname;
public string songname
{
get
{
return _songname;
}
set
{
_songname = value;
}
}
private Byte[] _song;
public Byte[] song
{
get
{
return _song;
}
set
{
_song = value;
}
}
#endregion
#region Database
public void Insert()
{
DBConnect.DBCommand.CommandText = "INSERT INTO tbSongs VALUES (?, ?, ?)";
DBConnect.DBCommand.Parameters.AddWithValue("@guid", guid);
DBConnect.DBCommand.Parameters.AddWithValue("@songname", songname);
DBConnect.DBCommand.Parameters.AddWithValue("@image", song);
DBConnect.DBCommand.ExecuteNonQuery();
DBConnect.DBCommand.Parameters.Clear();
}
to retrive the song from database :
Find you song with guid or name and cast datareader to bytes array.
public static byte[] GetFilebytes(guid guid)
{
DBCommand = new DBCommand("SELECT songfile FROM tbsongs WHERE guid = @guid", DataBase.DBConnection);
DBCommand.Parameters.AddWithValue("@guid", guid);
byte[] filebytes = (byte[])DBCommand.ExecuteScalar();
DataBase.DBCommand.Parameters.Clear();
return filebytes;
}
4-Use File Stream or Memory Stream to Save your Song
byte[] filebites = GetFilebytes(songguid)
FileStream fs = new FileStream("c:\\mysong.mp3", FileMode.CreateNew, FileAccess.Write);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(filebytes);
bw.Close();
fs.Close();
Hope this help
|
|
|
|
|
You can use a BLOB (binary large object) to store song data into the database.
This[^] might help.
|
|
|
|
|
I'v seen various posts on this and other forums about reading emails. While the C# code looks simple enough, what I'm confused on is the different 'technologies' that seem to be out there.
1) What is the difference between IMAP, MAPI, and POP3?
2) Is there a standard email message format?
Thanks!
If it's not broken, fix it until it is
|
|
|
|
|
I think a simple Google search can clarify your questions.
It depends on the Email provider or server configuration to access the emails. Most of the email services provides POP3/SMTP access to the user accounts. This standard is quite old and mostly meant for old mail clients. IMAP is a modern protocol to access emails and it too has several different versions. Google Mail supports POP and IMAP. On the other hand most of the corporate Emails runs Microsoft Exchange server and can be access with POP and Exchanges protocol.
MAPI is a properetiery API from Microsoft to access the Exchange Server and other mail protocols.
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
Kevin Marois wrote: Is there a standard email message format? Yes, see RFC 5322[^].
/ravi
|
|
|
|
|
In a C# 2008 console application, I am trying to call a java web service. I am getting the error: 'java.lang.Exception: java .lang.Exception: Please pass the correct mime type value'.
I am trying to pass an excel spreadsheet 2007 that has the extension *.xlsx. I am passing the following mine value to the web service:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
I have looked at urls like the following: http://filext.com/faq/office_mime_types.php to try different mine types. However none of these methods have worked.
Do you have any suggestions on what I can try next?
|
|
|
|
|
The term is not "mine type", it's "MIME type".
Even though that's the correct MIME type for an .xlsx file, I suggest you ask the maker of the web service for what it recognizes and supports. It's entirely possible that it doesn't support an .xlsx file, but maybe an older Excel format.
At this point, anyone to answer is just guessing, as are you.
|
|
|
|
|
In a C# 2008 application, I will obtain the current date by using the statement:
DateTime.Now;
I want to read from a file that is in part of the directory path of:
mm_dd_yy. Or in other words the format is: 09_27_12.
Thus can you tell me how to change the date obtained from datetime.now and make it look like: 09_27_12?
|
|
|
|
|
|
string date = DateTime.Now.ToString("dd/MM/yyyy");
string time = DateTime.Now.ToString("hh:mm:ss");
|
|
|
|
|
This only slightly answers the OP question, and the bit it does get right, uses the wrong format for what the OP asked.
|
|
|
|
|
Ravi has provided you with a link that should answer your question, so I'm not going to add to it. I'd like to make a suggestion as well. If you can, change the format of the date:
yyyy-MM-dd yyyy_MM_dd or yyyymmdd or somesuch
The format you have can be ambiguous between US and European date formats. This might not be a problem in itself (you may only ever deal in US dates). The other thing changing the date will do is allow you to sort the files by date via their filenames.
|
|
|
|
|
You would use a DateFormat string of MM_dd_yy , which can either be passed to the ToString method on a DateTime:
var formatted = DateTime.Now.ToString("MM_dd_yy")
or used in a larger format string, say for example if you're building up a path:
var path = String.Format("Some/Directory_{0:MM_dd_yy}/somefile.txt",DateTime.Now);
Here's a live example of the latter: http://rextester.com/UTHQ72076[^]
|
|
|
|
|
Try this.
protected string FormatDate()
{
string strTemp;
strTemp = DateTime.Now.ToString("MM/dd/yy").Replace("/", "_");
return strTemp;
}
KiranKumar Roy
|
|
|
|
|
hi guys , today i have read sth about exponential memory i dont know what is it or even if its exist or not .
can you guys give me some info , i need sth like this , bcz im working on a puzzle 8 problem and i want to slove it with bfs algorithm , and every time i start my code it gave me a overflow error bcz it fill up the memory too fast and make the program stop of working so , is that things that im noticed (exponential memory ) is really work or not ? and can you suggest me sth ?
|
|
|
|
|
I'm sorry. Could you tidy that up and not use text speak please? I could not understand what you were asking because of it.
|
|
|
|
|
Breadth-first finds the solution that is closest (in the graph) to the start node (always expands the shallowest node).
Keeps O(bd) nodes in memory exponential memory requirement!
what does mean of exponential memory ?
i dont know if you get it or not .
|
|
|
|
|
Stop for a minute and think about this. You're leaving out a lot of context. Nobody has any clue what the hell you're doing or why.
If you've got a link to something you're looking at or a problem you're trying to solve, the great, post it! It would probably clear this up real quick.
|
|
|
|
|
mohammadkaab wrote: overflow error
Which typically means 'stack' overflow.
And that would normally be associated with recursion.
Not sure what "puzzle 8" is but if the size is 8 I wouldn't expect an overflow unless there is a recursion method that isn't ending.
|
|
|
|
|
so i think there should be some wrong with my code .
but my code work fine in easy problems . it just dont work with big problems .
|
|
|
|
|
Again...there's not context here.
WHAT problems are you talking about??
|
|
|
|
|
Read this[^] and update your question.
From what I gather, I think you need to rethink your strategy. .Net can hold up objects in memory up to two GB I believe, if that's not enough for a puzzle 8 problem you're really, really going into the wrong direction.
|
|
|
|