Hi everyone,
Here is code working on..Trying to insert record with a column with Image
or VarBinary datatype in sql database from a existing jpeg image file, then
retrieve this image from database and display it in a Image web control
dynamically(at runtime).
The process after being displayed in the web control, user click insert/add
button, it converts the image(jpeg) file to bytes[] and store it the database
with Image or VarBinary Datatype. While in retrieval, I get the specific
record, store the Image or VarBinary Data in local byte[] variable, and then
convert this to a image (jpeg) file and used the filepath to display file.
The problem still unable to display image and create image file. -
//Get Image Record Stored and display them
-
private void GetImageRecord()
-
{
-
if (CheckFields(2))
-
{
-
string sqlText = "Select * From PictureImages Where ImageName =
-
@ImgName";
-
SqlCommand cmd = new SqlCommand(sqlText, conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
-
SqlDataReader dr = cmd.ExecuteReader();
-
string filePath = Request.PhysicalApplicationPath +
-
txtImgName.Text + ".jpg";
-
FileStream fs = new FileStream(filePath, FileMode.Create,
-
FileAccess.Write);
-
-
byte[] storedByte = null;
-
//byte storedByte = null;
-
//MemoryStream ms = new MemoryStream(storedByte);
-
//StreamWriter sw = new StreamWriter(filePath);
-
-
while (dr.Read())
-
{
-
lblImgNo.Text = dr["ImageNo"].ToString();
-
txtImgDesc.Text = dr["Description"].ToString();
-
txtImgUrl.Text = dr["ImageUrl"].ToString();
-
storedByte = (byte[])dr["ImageData"];
-
//long lRes = dr.GetBytes(5,0,storedByte,0,100);
-
}
-
MemoryStream ms = new MemoryStream(storedByte, 0,
-
storedByte.Length);
-
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
- <<--- Error Occurred Here
-
System.Drawing.Image otherImg = img.GetThumbnailImage(100, 100,
-
null, new IntPtr());
-
//otherImg.Save(ms, img.RawFormat);
-
otherImg.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
-
-
//byte[] byteImg = new byte[ms.Length];
-
//ms.Position = 0;
-
//ms.Read(byteImg, 0, byteImg.Length);
-
-
//System.Drawing.Image img = System.Drawing.Image.FromStream(new
-
MemoryStream(storedByte, 0, storedByte.Length));
-
//img.Save(filePath);
-
-
//fs.Write(storedByte, 0, storedByte.Length);
-
//fs.Flush();
-
//fs.Close();
-
if (File.Exists(filePath))
-
PicImg2.ImageUrl = filePath;
-
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
}
-
}
-
-
private void InsertProcess()
-
{
-
if (CheckFields(1))
-
{
-
FileStream fs = new
-
FileStream(txtImgFile.Text.Trim(),FileMode.OpenOrCreate,FileAccess.Read);
-
-
byte[] imgByte = new byte[fs.Length];
-
fs.Read(imgByte,0,(int)fs.Length);
-
fs.Close();
-
//Testing storing image as binary in database
-
-
string sqlText = "Insert PictureImages
-
Values(@ImgName,@Desc,@Url,@Img)";
-
SqlCommand cmd = new SqlCommand(sqlText,conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
cmd.Parameters.Add("@Desc", SqlDbType.VarChar, 100,
-
"Description").Value = txtImgDesc.Text.Trim();
-
cmd.Parameters.Add("@Url", SqlDbType.VarChar, 50,
-
"ImageUrl").Value = txtImgUrl.Text.Trim();
-
cmd.Parameters.Add("@Img", SqlDbType.Image, 16,
-
"ImageData").Value = imgByte;
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
-
int iRes = cmd.ExecuteNonQuery();
-
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
-
if (iRes 0)
-
lblMessage.Text = "Successfully Added New Record.";
-
else
-
lblMessage.Text = "Failed to add new record.";
-
}
-
}
-
-
private void InsertProcess2()
-
{
-
if (CheckFields(0))
-
{
-
HttpPostedFile imgFile = txtFile1.PostedFile;
-
int imgLen = imgFile.ContentLength;
-
string imgType = imgFile.ContentType;
-
byte[] imgByte = new byte[imgLen];
-
imgFile.InputStream.Read(imgByte, 0, imgLen);
-
-
//Testing storing image as binary in database
-
-
string sqlText = "Insert PictureImages
-
Values(@ImgName,@Desc,@Url,@Img)";
-
SqlCommand cmd = new SqlCommand(sqlText, conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
cmd.Parameters.Add("@Desc", SqlDbType.VarChar, 100,
-
"Description").Value = txtImgDesc.Text.Trim();
-
cmd.Parameters.Add("@Url", SqlDbType.VarChar, 50,
-
"ImageUrl").Value = txtImgUrl.Text.Trim();
-
cmd.Parameters.Add("@Img", SqlDbType.Image, 16,
-
"ImageData").Value = imgByte;
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
-
int iRes = cmd.ExecuteNonQuery();
-
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
-
if (iRes 0)
-
lblMessage.Text = "Successfully Added New Record.";
-
else
-
lblMessage.Text = "Failed to add new record.";
-
}
-
}
-
Anyone?
Thanks in Advanced...
den2005
--
MCP Year 2005, Philippines 3 5238
Hi Den,
just wanted to know why you store the images as such in the database.
I believe, it is recommended to save images in file system and store the
filepaths in database rather than storing the entire image in database.
Augustin
"den 2005" wrote:
Hi everyone,
Here is code working on..Trying to insert record with a column with Image
or VarBinary datatype in sql database from a existing jpeg image file, then
retrieve this image from database and display it in a Image web control
dynamically(at runtime).
The process after being displayed in the web control, user click insert/add
button, it converts the image(jpeg) file to bytes[] and store it the database
with Image or VarBinary Datatype. While in retrieval, I get the specific
record, store the Image or VarBinary Data in local byte[] variable, and then
convert this to a image (jpeg) file and used the filepath to display file.
The problem still unable to display image and create image file.
-
//Get Image Record Stored and display them
-
private void GetImageRecord()
-
{
-
if (CheckFields(2))
-
{
-
string sqlText = "Select * From PictureImages Where ImageName =
-
@ImgName";
-
SqlCommand cmd = new SqlCommand(sqlText, conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
SqlDataReader dr = cmd.ExecuteReader();
-
string filePath = Request.PhysicalApplicationPath +
-
txtImgName.Text + ".jpg";
-
FileStream fs = new FileStream(filePath, FileMode.Create,
-
FileAccess.Write);
-
byte[] storedByte = null;
-
//byte storedByte = null;
-
//MemoryStream ms = new MemoryStream(storedByte);
-
//StreamWriter sw = new StreamWriter(filePath);
-
while (dr.Read())
-
{
-
lblImgNo.Text = dr["ImageNo"].ToString();
-
txtImgDesc.Text = dr["Description"].ToString();
-
txtImgUrl.Text = dr["ImageUrl"].ToString();
-
storedByte = (byte[])dr["ImageData"];
-
//long lRes = dr.GetBytes(5,0,storedByte,0,100);
-
}
-
MemoryStream ms = new MemoryStream(storedByte, 0,
-
storedByte.Length);
-
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
- <<--- Error Occurred Here
-
System.Drawing.Image otherImg = img.GetThumbnailImage(100, 100,
-
null, new IntPtr());
-
//otherImg.Save(ms, img.RawFormat);
-
otherImg.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
-
//byte[] byteImg = new byte[ms.Length];
-
//ms.Position = 0;
-
//ms.Read(byteImg, 0, byteImg.Length);
-
//System.Drawing.Image img = System.Drawing.Image.FromStream(new
-
MemoryStream(storedByte, 0, storedByte.Length));
-
//img.Save(filePath);
-
//fs.Write(storedByte, 0, storedByte.Length);
-
//fs.Flush();
-
//fs.Close();
-
if (File.Exists(filePath))
-
PicImg2.ImageUrl = filePath;
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
}
-
}
-
private void InsertProcess()
-
{
-
if (CheckFields(1))
-
{
-
FileStream fs = new
-
FileStream(txtImgFile.Text.Trim(),FileMode.OpenOrCreate,FileAccess.Read);
-
byte[] imgByte = new byte[fs.Length];
-
fs.Read(imgByte,0,(int)fs.Length);
-
fs.Close();
-
//Testing storing image as binary in database
-
string sqlText = "Insert PictureImages
-
Values(@ImgName,@Desc,@Url,@Img)";
-
SqlCommand cmd = new SqlCommand(sqlText,conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
cmd.Parameters.Add("@Desc", SqlDbType.VarChar, 100,
-
"Description").Value = txtImgDesc.Text.Trim();
-
cmd.Parameters.Add("@Url", SqlDbType.VarChar, 50,
-
"ImageUrl").Value = txtImgUrl.Text.Trim();
-
cmd.Parameters.Add("@Img", SqlDbType.Image, 16,
-
"ImageData").Value = imgByte;
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
int iRes = cmd.ExecuteNonQuery();
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
if (iRes 0)
-
lblMessage.Text = "Successfully Added New Record.";
-
else
-
lblMessage.Text = "Failed to add new record.";
-
}
-
}
-
private void InsertProcess2()
-
{
-
if (CheckFields(0))
-
{
-
HttpPostedFile imgFile = txtFile1.PostedFile;
-
int imgLen = imgFile.ContentLength;
-
string imgType = imgFile.ContentType;
-
byte[] imgByte = new byte[imgLen];
-
imgFile.InputStream.Read(imgByte, 0, imgLen);
-
//Testing storing image as binary in database
-
string sqlText = "Insert PictureImages
-
Values(@ImgName,@Desc,@Url,@Img)";
-
SqlCommand cmd = new SqlCommand(sqlText, conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
cmd.Parameters.Add("@Desc", SqlDbType.VarChar, 100,
-
"Description").Value = txtImgDesc.Text.Trim();
-
cmd.Parameters.Add("@Url", SqlDbType.VarChar, 50,
-
"ImageUrl").Value = txtImgUrl.Text.Trim();
-
cmd.Parameters.Add("@Img", SqlDbType.Image, 16,
-
"ImageData").Value = imgByte;
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
int iRes = cmd.ExecuteNonQuery();
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
if (iRes 0)
-
lblMessage.Text = "Successfully Added New Record.";
-
else
-
lblMessage.Text = "Failed to add new record.";
-
}
-
}
-
Anyone?
Thanks in Advanced...
den2005
--
MCP Year 2005, Philippines
This article should be of help.. http://www.netomatix.com/development...splayBlob.aspx
"den 2005" <de*****@discus sions.microsoft .comwrote in message
news:F1******** *************** ***********@mic rosoft.com...
Hi everyone,
Here is code working on..Trying to insert record with a column with Image
or VarBinary datatype in sql database from a existing jpeg image file,
then
retrieve this image from database and display it in a Image web control
dynamically(at runtime).
The process after being displayed in the web control, user click
insert/add
button, it converts the image(jpeg) file to bytes[] and store it the
database
with Image or VarBinary Datatype. While in retrieval, I get the specific
record, store the Image or VarBinary Data in local byte[] variable, and
then
convert this to a image (jpeg) file and used the filepath to display file.
The problem still unable to display image and create image file.
-
//Get Image Record Stored and display them
-
private void GetImageRecord()
-
{
-
if (CheckFields(2))
-
{
-
string sqlText = "Select * From PictureImages Where ImageName =
-
@ImgName";
-
SqlCommand cmd = new SqlCommand(sqlText, conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
SqlDataReader dr = cmd.ExecuteReader();
-
string filePath = Request.PhysicalApplicationPath +
-
txtImgName.Text + ".jpg";
-
FileStream fs = new FileStream(filePath, FileMode.Create,
-
FileAccess.Write);
-
byte[] storedByte = null;
-
//byte storedByte = null;
-
//MemoryStream ms = new MemoryStream(storedByte);
-
//StreamWriter sw = new StreamWriter(filePath);
-
while (dr.Read())
-
{
-
lblImgNo.Text = dr["ImageNo"].ToString();
-
txtImgDesc.Text = dr["Description"].ToString();
-
txtImgUrl.Text = dr["ImageUrl"].ToString();
-
storedByte = (byte[])dr["ImageData"];
-
//long lRes = dr.GetBytes(5,0,storedByte,0,100);
-
}
-
MemoryStream ms = new MemoryStream(storedByte, 0,
-
storedByte.Length);
-
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
- <<--- Error Occurred Here
-
System.Drawing.Image otherImg = img.GetThumbnailImage(100, 100,
-
null, new IntPtr());
-
//otherImg.Save(ms, img.RawFormat);
-
otherImg.Save(filePath,
-
System.Drawing.Imaging.ImageFormat.Jpeg);
-
//byte[] byteImg = new byte[ms.Length];
-
//ms.Position = 0;
-
//ms.Read(byteImg, 0, byteImg.Length);
-
//System.Drawing.Image img =
-
System.Drawing.Image.FromStream(new
-
MemoryStream(storedByte, 0, storedByte.Length));
-
//img.Save(filePath);
-
//fs.Write(storedByte, 0, storedByte.Length);
-
//fs.Flush();
-
//fs.Close();
-
if (File.Exists(filePath))
-
PicImg2.ImageUrl = filePath;
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
}
-
}
-
private void InsertProcess()
-
{
-
if (CheckFields(1))
-
{
-
FileStream fs = new
-
FileStream(txtImgFile.Text.Trim(),FileMode.OpenOrCreate,FileAccess.Read);
-
byte[] imgByte = new byte[fs.Length];
-
fs.Read(imgByte,0,(int)fs.Length);
-
fs.Close();
-
//Testing storing image as binary in database
-
string sqlText = "Insert PictureImages
-
Values(@ImgName,@Desc,@Url,@Img)";
-
SqlCommand cmd = new SqlCommand(sqlText,conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
cmd.Parameters.Add("@Desc", SqlDbType.VarChar, 100,
-
"Description").Value = txtImgDesc.Text.Trim();
-
cmd.Parameters.Add("@Url", SqlDbType.VarChar, 50,
-
"ImageUrl").Value = txtImgUrl.Text.Trim();
-
cmd.Parameters.Add("@Img", SqlDbType.Image, 16,
-
"ImageData").Value = imgByte;
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
int iRes = cmd.ExecuteNonQuery();
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
if (iRes 0)
-
lblMessage.Text = "Successfully Added New Record.";
-
else
-
lblMessage.Text = "Failed to add new record.";
-
}
-
}
-
private void InsertProcess2()
-
{
-
if (CheckFields(0))
-
{
-
HttpPostedFile imgFile = txtFile1.PostedFile;
-
int imgLen = imgFile.ContentLength;
-
string imgType = imgFile.ContentType;
-
byte[] imgByte = new byte[imgLen];
-
imgFile.InputStream.Read(imgByte, 0, imgLen);
-
//Testing storing image as binary in database
-
string sqlText = "Insert PictureImages
-
Values(@ImgName,@Desc,@Url,@Img)";
-
SqlCommand cmd = new SqlCommand(sqlText, conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
cmd.Parameters.Add("@Desc", SqlDbType.VarChar, 100,
-
"Description").Value = txtImgDesc.Text.Trim();
-
cmd.Parameters.Add("@Url", SqlDbType.VarChar, 50,
-
"ImageUrl").Value = txtImgUrl.Text.Trim();
-
cmd.Parameters.Add("@Img", SqlDbType.Image, 16,
-
"ImageData").Value = imgByte;
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
int iRes = cmd.ExecuteNonQuery();
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
if (iRes 0)
-
lblMessage.Text = "Successfully Added New Record.";
-
else
-
lblMessage.Text = "Failed to add new record.";
-
}
-
}
-
Anyone?
Thanks in Advanced...
den2005
--
MCP Year 2005, Philippines
Augustin,
That's the requirement what I am doing right now.
Winista,
Thanks for the link, but I am seen this approach, I am looking for
approach that converts stored sql binary/image datatype data back to an image
(jpeg) file.
dennis
--
MCP Year 2005, Philippines
"Winista" wrote:
This article should be of help..
http://www.netomatix.com/development...splayBlob.aspx
"den 2005" <de*****@discus sions.microsoft .comwrote in message
news:F1******** *************** ***********@mic rosoft.com...
Hi everyone,
Here is code working on..Trying to insert record with a column with Image
or VarBinary datatype in sql database from a existing jpeg image file,
then
retrieve this image from database and display it in a Image web control
dynamically(at runtime).
The process after being displayed in the web control, user click
insert/add
button, it converts the image(jpeg) file to bytes[] and store it the
database
with Image or VarBinary Datatype. While in retrieval, I get the specific
record, store the Image or VarBinary Data in local byte[] variable, and
then
convert this to a image (jpeg) file and used the filepath to display file.
The problem still unable to display image and create image file. -
//Get Image Record Stored and display them
-
private void GetImageRecord()
-
{
-
if (CheckFields(2))
-
{
-
string sqlText = "Select * From PictureImages Where ImageName =
-
@ImgName";
-
SqlCommand cmd = new SqlCommand(sqlText, conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
-
SqlDataReader dr = cmd.ExecuteReader();
-
string filePath = Request.PhysicalApplicationPath +
-
txtImgName.Text + ".jpg";
-
FileStream fs = new FileStream(filePath, FileMode.Create,
-
FileAccess.Write);
-
-
byte[] storedByte = null;
-
//byte storedByte = null;
-
//MemoryStream ms = new MemoryStream(storedByte);
-
//StreamWriter sw = new StreamWriter(filePath);
-
-
while (dr.Read())
-
{
-
lblImgNo.Text = dr["ImageNo"].ToString();
-
txtImgDesc.Text = dr["Description"].ToString();
-
txtImgUrl.Text = dr["ImageUrl"].ToString();
-
storedByte = (byte[])dr["ImageData"];
-
//long lRes = dr.GetBytes(5,0,storedByte,0,100);
-
}
-
MemoryStream ms = new MemoryStream(storedByte, 0,
-
storedByte.Length);
-
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
-
<<--- Error Occurred Here
-
System.Drawing.Image otherImg = img.GetThumbnailImage(100, 100,
-
null, new IntPtr());
-
//otherImg.Save(ms, img.RawFormat);
-
otherImg.Save(filePath,
-
System.Drawing.Imaging.ImageFormat.Jpeg);
-
-
//byte[] byteImg = new byte[ms.Length];
-
//ms.Position = 0;
-
//ms.Read(byteImg, 0, byteImg.Length);
-
-
//System.Drawing.Image img =
-
System.Drawing.Image.FromStream(new
-
MemoryStream(storedByte, 0, storedByte.Length));
-
//img.Save(filePath);
-
-
//fs.Write(storedByte, 0, storedByte.Length);
-
//fs.Flush();
-
//fs.Close();
-
if (File.Exists(filePath))
-
PicImg2.ImageUrl = filePath;
-
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
}
-
}
-
-
private void InsertProcess()
-
{
-
if (CheckFields(1))
-
{
-
FileStream fs = new
-
FileStream(txtImgFile.Text.Trim(),FileMode.OpenOrCreate,FileAccess.Read);
-
-
byte[] imgByte = new byte[fs.Length];
-
fs.Read(imgByte,0,(int)fs.Length);
-
fs.Close();
-
//Testing storing image as binary in database
-
-
string sqlText = "Insert PictureImages
-
Values(@ImgName,@Desc,@Url,@Img)";
-
SqlCommand cmd = new SqlCommand(sqlText,conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
cmd.Parameters.Add("@Desc", SqlDbType.VarChar, 100,
-
"Description").Value = txtImgDesc.Text.Trim();
-
cmd.Parameters.Add("@Url", SqlDbType.VarChar, 50,
-
"ImageUrl").Value = txtImgUrl.Text.Trim();
-
cmd.Parameters.Add("@Img", SqlDbType.Image, 16,
-
"ImageData").Value = imgByte;
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
-
int iRes = cmd.ExecuteNonQuery();
-
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
-
if (iRes 0)
-
lblMessage.Text = "Successfully Added New Record.";
-
else
-
lblMessage.Text = "Failed to add new record.";
-
}
-
}
-
-
private void InsertProcess2()
-
{
-
if (CheckFields(0))
-
{
-
HttpPostedFile imgFile = txtFile1.PostedFile;
-
int imgLen = imgFile.ContentLength;
-
string imgType = imgFile.ContentType;
-
byte[] imgByte = new byte[imgLen];
-
imgFile.InputStream.Read(imgByte, 0, imgLen);
-
-
//Testing storing image as binary in database
-
-
string sqlText = "Insert PictureImages
-
Values(@ImgName,@Desc,@Url,@Img)";
-
SqlCommand cmd = new SqlCommand(sqlText, conn);
-
cmd.Parameters.Add("@ImgName", SqlDbType.VarChar, 20,
-
"ImageName").Value = txtImgName.Text.Trim();
-
cmd.Parameters.Add("@Desc", SqlDbType.VarChar, 100,
-
"Description").Value = txtImgDesc.Text.Trim();
-
cmd.Parameters.Add("@Url", SqlDbType.VarChar, 50,
-
"ImageUrl").Value = txtImgUrl.Text.Trim();
-
cmd.Parameters.Add("@Img", SqlDbType.Image, 16,
-
"ImageData").Value = imgByte;
-
if (conn.State == ConnectionState.Closed)
-
conn.Open();
-
-
int iRes = cmd.ExecuteNonQuery();
-
-
if (conn.State == ConnectionState.Open)
-
conn.Close();
-
-
if (iRes 0)
-
lblMessage.Text = "Successfully Added New Record.";
-
else
-
lblMessage.Text = "Failed to add new record.";
-
}
-
}
-
Anyone?
Thanks in Advanced...
den2005
--
MCP Year 2005, Philippines
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Satish |
last post by:
Dear all,
Iam unable to laod images at runtime from the file folder / database
through C# code with asp. net and Crystal reports
All the solutions given are through RDC COM Component..
but no information is available for CR for VS.net this is with File
server based image loading using OLE object.
Thanks in advance.
-satish
|
by: hussein |
last post by:
'm not bale to run my projec on the 2000 server, he error was:
error while trying to run project: unable to start debugging on the web server.erver side error occurred on sending debug HTTP request
mak sure that the server is running correctly . verify that there are o syntax errors in the web.config...
i check the IIS, it is running correctly, also the webconfig so what am i sposed to to do be able to run it
|
by: Eric Keung |
last post by:
Hi all,
my case is I want to get an image from access database and I just know it's "OLE object" field type at access
I also don't know how to insert it into access
here is my code and it just can display a invalid image
try
dim strConn as string
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath
|
by: js |
last post by:
Does anybody knows how to solve the problem? I added
attribute to the following classes in
Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get
the error. Thanks.
Database.cs
DatabaseFactory.cs
DatabaseProviderFactory.cs
DBCommandWrapper.cs
|
by: Nachi |
last post by:
I have installed SQL Server 2000 with VS 2005 - did not install
SqlExpress\Sql 2005. I have a remote Sql Server Instance locally. The
normal application connectes to this Sql Server. When I run Asp.Net
Configuration from VS 2005 it gives this error.
I have removed 'LocalSqlServer' in machine.Config and added in
web.config as following.
| |
by: eholz1 |
last post by:
Hello Group,
Perhaps you can help me. I have a mysql db, that holds images.
Images are encoded using base64_decode/encode, etc. Image data seems
fine.
I have a view.php page that is supposed to show the image, and an
image.php page that accesses
the database, retrives the image data, and then (theoretically) prints
the decoded data to the page.
below is the view.php page code: problem area the img tag src no
|
by: Erik Lautier |
last post by:
Hello, I'm using a multipart/form-data upload to put an image into SQL
Server, and it appears to be working, but I'm unable to display the
image. All I'm getting is the text of the URL we're on in Firefox and
a missing image icon in IE! Any ideas why this isn't working? Here's
the image upload code:
Dim intImageSize As Int64
Dim strImageType As String
Dim ImageStream As Stream
|
by: kulkanuja |
last post by:
i am using image control in asp.net in c# now i want to display binary(format) image from database to image control.
how do i do iot pls help.
|
by: swethak |
last post by:
Hi,
I write the code to display images.But it will not display image.And also gives the error like that
error : Notice: Undefined index: gim in F:\Facebook\pic_up.php on line 59
plz tell that what is the problem in that code
<?php
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |