Problem Displaying Image Data From SQL Server
Apr 12, 2007
Hello,
I'm having problems saving and then displaying binary data in sql server.
I have a form that takes a file specified by the user and inserts this into sql server:
protected void btnUploadFile_Click(object sender, EventArgs e)
{
if (theFile.PostedFile != null)
{
if (theFile.PostedFile.ContentLength > 0)
{
byte[] docBuffer = new byte[theFile.PostedFile.ContentLength];
Response.Write(theFile.PostedFile.ContentType.ToString());
if (docBuffer.Length > 0)
{
// save to db
DbAccess dbAccess = new DbAccess(); // my helper function for all db access etc
try
{
dbAccess.BuildCommand("Incentives_SaveDocument");
dbAccess.Parameters.Add("@docImage", SqlDbType.Image).Value = docBuffer;
dbAccess.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
}
}
}
Stored proc:
ALTER PROCEDURE Incentives_SaveDocument
@docImage image
AS
SET NOCOUNT ON
INSERT INTO Table1 (theData) VALUES (@docImage)
RETURN
This appears to work fine. I store the binary data in a image column and if I query the db it shows the row as <Binary>.
The problem I have is with retrieving the data and saving it to a file. The file saves OK but when I open it is contains lots of "squares" that I suppose are the binary - it doesn't show the text.
The code for retrieving/displaying the doc is:
protected void btnView_Click(object sender, EventArgs e)
{
DbAccess dbAccess = new DbAccess();
byte[] byteArray = null;
try
{
dbAccess.BuildCommand("Incentives_RetrieveDocument");
dbAccess.Parameters.Add("@id", SqlDbType.Int).Value = 6; // id for the doc to return
SqlDataReader reader1 = dbAccess.ReturnDataReader();
while (reader1.Read())
{
if (reader1.HasRows)
{
byteArray = (byte[])reader1["theData"];
}
}
reader1.Close();
FileStream fs = new FileStream("file1", FileMode.CreateNew, FileAccess.Write);
fs.Write(byteArray, 0, byteArray.Length);
fs.Flush();
fs.Close();
FileInfo fileInfo = new FileInfo("file1");
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name);
HttpContext.Current.Response.AddHeader("Content-Length", fileInfo.Length.ToString());
HttpContext.Current.Response.ContentType = "application/msword";
HttpContext.Current.Response.WriteFile(fileInfo.FullName);
HttpContext.Current.Response.End();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
finally
{
dbAccess.CloseDbConnection();
}
The stored proc:
ALTER PROCEDURE Incentives_RetrieveDocument
@id int
AS
SET NOCOUNT ON
SELECT * FROM Table1 WHERE id = @id
RETURN
I would be grateful for any advice on this - its the first time I've worked with BLOB data.
Thanks
Si
View 2 Replies
ADVERTISEMENT
Jul 14, 2007
hi friends, i need a code for storing and receiving an image to/fro SQL SERVER 2000 (in C#). i had searched some sites, all are in VB for windows forms not for website. finally i got a code from some site. it is working for storing purpose. not working for receiving purpose. the code for receiving and displaying purpose is (in a fresh page) private void Page_Load(object sender, System.EventArgs e){ // Put user code to initialize the page here MemoryStream stream = new MemoryStream (); SqlConnection connection = new SqlConnection (@"server=INDIAINDIA;database=iSense;uid=sa;pwd=india"); try { connection.Open (); SqlCommand command = new SqlCommand ("select Picture from Image", connection); byte[] image = (byte[]) command.ExecuteScalar (); stream.Write (image, 0, image.Length); Bitmap bitmap = new Bitmap (stream); Response.ContentType = "image/gif"; bitmap.Save (Response.OutputStream, ImageFormat.Gif); } finally { connection.Close (); stream.Close (); }}what s the problem is.........i'm getting an exception at Bitmap instantiation.(i.e Bitmap bitmap = new Bitmap (stream);)exception is "Parameter is not valid" what is the problem with that coding? was it correct? do u have any code for this in C#? if so, pls provide that......help me........pls.............
View 2 Replies
View Related
Apr 20, 2007
I am using the 3-tiered architecture design (presentation, business laws, and data acess layers). I am stuck on how to send the image the user selects in the upload file control to the BLL and then to the DAL because the DAL does all the inserts into the database. I would like to be able to check the file type in the BLL to make sure the file being uploaded is indeed a picture. Is there a way I can send the location of the file to the BLL, check the filetype, then upload the file and have the DAL insert the image into the database? I have seen examples where people use streams to upload the file directly from their presentation layer, but I would like to keep everything seperated in the three classes if possible. I also wasn't sure what variable type the image would be in the function in the BLL that receive the image from the PL. If there are any examples or tips anyone can give me that would be appreciated.
View 2 Replies
View Related
Nov 3, 2003
I am able to write an image to a SQL table. The problem I am having is understanding how to retrieve the image from the table AND display it on a page along with the other page content.
Does anyone have an example or an article to help me with this procedure? I have searched the discussion and read a few articles but they all talk about reading an image into a datagrid which isn't what I want.
Dazed & confused!!!
View 2 Replies
View Related
Jun 10, 2004
I'm trying to retrieve an image that I have stored in a SQL Server db, and display it in an .aspx page. It's supposed to retrieve just one image, according to a unique key that's passed. However, when I view the page, nothing appears... just the Internet Explorer missing image placeholder.
I've tried code from several diff tutorials, and can't seem to get it to work.
I'm aware that some people think it's not a good idea to store images in a db, but I have to in this case, since the requirements for this project are that the images are stored in the database. I already know how to store references to file paths of images located in a server folder. I've just never done it this way... storing the whole images in the database. The table has 3 columns, one for the id, "FileType" stores the image type, and the "ImageBinary" is the image itself.
If anyone can shine some light on why my code doesn't display anything, I'd greatly appreciated your help.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Response.Write("Page Loaded") 'This is just for testing to see if the page loads at all
Dim myCommand As New SqlCommand("Select * from UserImages WHERE id=1234", myConnection)
Try
myConnection.Open()
Dim DR As SqlDataReader
DR = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
If DR.Read() Then
Response.ContentType = DR.Item("FileType")
Response.BinaryWrite(DR("ImageBinary"))
Else
Response.Write("no image found")
End If
myConnection.Close()
Response.Write("<br>Image successfully retrieved!")
Catch SQLexc As SqlException
Response.Write("Read Failed : " & SQLexc.ToString())
End Try
End Sub
View 2 Replies
View Related
Feb 18, 2008
Hello Guys, I am trying to display image on a report. The image field is stored as a binary data in the database. I am using webservice to access the database and return datasets through which data on the report can be accessed. I saw that the xml returns binarystring value from the database. but when i try to display the image it does not show me anything except blank page. I checked the value of the binary data and it does not proceed with ox and tried appending 0x value but no luck. Guys please help me.
View 2 Replies
View Related
Oct 19, 2006
can some one help me. im using visual studio.net 2005. its a web application.i have a database with attribute name logo. so i want to upload an image and save it into the database and than display it into the image box to preview how the image looks like.can some one please help me as i am very new in using C# codes and visual studio.net 2005
View 5 Replies
View Related
Jan 23, 2007
How to display an database image in the Report page header of sql server reporting service?
View 3 Replies
View Related
Jan 9, 2005
Does anyone know how to display the properties of a column / data field in ASP? Thanks!
View 6 Replies
View Related
Jul 26, 2007
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NWHCConnectionString %>" SelectCommand="SELECT * FROM [AI_news]" OnSelecting="SqlDataSource1_Selecting"> </asp:SqlDataSource> This is my code, I have followed the wizard perfectly the way its supposed ot be, well not 100% perfectly. This is how its supposed to be. When using a XXXX.MDF file I could use the wizard and it works fine. I do not know why my above code won't work. I am connected to the database and can view code manually. but not on a aspx page. i am using master page, now trying to add this into default.aspx Any help will be appreciated. I am currently losing some hair.
View 4 Replies
View Related
Jul 20, 2005
Hi! Guys,May be this question is little stupid but I want to clarify this.Let suppose I have image data field in Sql server 2000 and I am uploadingan image of 10KB(thru asp.net application).What would be the size for that table with image data field ?Is it 10KB or less than 10KB or more than 10KB ?ThanksJohnwww.e-classifiedad.com
View 2 Replies
View Related
Sep 19, 2007
Here is my task I am storing pdf's in sql server. I would like to retrieve the binary data from sql server and write the pdf content into an existing aspx page to the appropriate pageview section. What is the best way to handle this. The code works below but it loads a new browser with the content. I need it to appear in it's tabbed section in the original aspx file. Any assistance you can give me would be greatly appreciated.
Thanks Jerry
oSQLConn.Open()Dim myreader As SqlDataReader
myreader = myCommand.ExecuteReader
Response.Expires = 0
Response.Buffer = True
Response.Clear()
Do While (myreader.Read())
Response.ContentType = ("application/pdf")Response.BinaryWrite(myreader.Item("img_content"))
Loop
View 5 Replies
View Related
Mar 4, 2004
Hi Guys,
I've been strugling with this problem all morning today.
Basically I store images in SQL Server 2000 database and then whould like to show them with
<img src="viewImage.aspx?image_id=10" border=1>
My table structure is setup this way
TABLE [userImages] (
[imageFilename] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[imageContentType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[imageFileSize] [bigint] NULL ,
[imageFileImage] [image] NULL )
and in viewImage.aspx I have:
if (dr.Read())
{
Response.ContentType = dr.GetString(dr.GetOrdinal("imageContentType"));
Response.BinaryWrite( (byte[]) dr["imageFileImage"] );
}
I have no prolems retrieving the data from DB. But the image does not display(in IE it shows a broken link image)
What's even more puzzling is I CAN display the same image from HDD like so:
FileStream fs = File.OpenRead("D:\my_image.png");
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(buffer);
Am I missing something very obvious. I tried playing around with different ContentType's same result.
In my case I am forced to store images in the DB.
I've seen other examples on the net and theirs work. Please help.
Sincerely,
Vlad Orlovsky
View 1 Replies
View Related
Oct 23, 2006
Hi All,
I am manually replicating parts of a SQL Server CE database (running windows mobile 5.0) to a centralized SQL Server 2000 database.
My program is throwing an exception whenever I try to insert an image data type into the 2000 server from the PDA. I am using parameterized queries.
Error is as follows:
[error]
System.Data.SqlClient.SqlConnection.OnError()
at
System.Data.SqlClient.SqlInternalConnection.OnError()
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at
System.Data.SqlClient.TdsParser.Run()
at
System.Data.SqlClient.ExecuteReader()
at
System.Data.SqlClient.ExecuteNonQuery()
at
PDASync.Database.ExecuteIDRemote()
[/error]
The code for my ExecuteIDRemote method works fine for other queries. It also works if I remove the image column from the offending query.
Does anyone have any suggestions? Thanks.
View 1 Replies
View Related
Nov 27, 2006
This just happened today and I dont know why. I have a database on a SQL server 2005 database, that has a table called photos. It contains image data, but not the column says <Unable to read data>. But before that I get an error when I try to execute the table to retreive the data. The error is below. SQL Execution Error:Executed SQL statement: SELECT ID, AlbumID, Caption, BytesOriginal, BytesFull, BytesThumb FROM PhotosError Source: System.DataError Message: Invalid attempt to Read when reader is closed. This happens with SQL Server Management Studio, and Visual Studio 2005 when I try to access it. I tried two computers so its not that. Any help or insight would be appreciated.
View 2 Replies
View Related
Jun 27, 2007
Hay Friend's
Can u plese send me the way how to save image in sql server and display that images in datagrid or other control also like Image control or Image control Button?? Plese send the coding in C#.
Thank's
Amit
View 5 Replies
View Related
Jul 12, 2007
hi all,
i have created a table with image field in it. Now i just want to store a jpeg file in it but not finding any way to do so.
how can i store any image ? what are the steps???????
thanx in advance
View 5 Replies
View Related
Jul 6, 2006
Ok, the problem is that , i have a field called "Attach" in sql of type image, when selecting it , the field is getting data of type BYTE(). which am being unable to display them on an Image on the panel.
using the following vb.net code:
'Dim sel2 As String
'Dim myCom As SqlCommand
'Dim conn As New SqlConnection
'Dim drr As SqlDataReader
'Dim image As System.Drawing.Image
'sel2 = "select * from attach where att_desc = '" & DropDownList1.SelectedItem().Text & "' and doc_code = " & w_doc_code & " and subcode = " & w_doc_subcode & " and doc_num= " & w_doc_num & " "
'conn.ConnectionString = ("server=developer01;uid=sa;password=aims;database=DVPSOC;timeout=45")
'myCom = New SqlCommand(sel2, conn)
'conn.Open()
'drr = myCom.ExecuteReader()
'If drr.Read Then
' Me.ImageMap1.ImageUrl = drr.Item("attach")
'End If
'conn.Close()
Am getting an exeption on the following line Me.ImageMap1.ImageUrl = drr.Item("attach")
saying: Conversion from type 'Byte()' to type 'String' is not valid.
knowing that i tried converting using ToString but it's not getting any output then.
thanks for your help.
View 4 Replies
View Related
Aug 21, 2007
Sql Server 2000
I am looking for bidirectional transactional replication using updatable subscribers (queued or immediate) . Is it possible to replicate the image data from the updatable subscribers to the publisher. I understood that the Image data can't be replicated to the publisher from the updatable subscriber. I am not using the WRITETEXT or UPDATETEXT. I am using just INSERT and UPDATE for image data type transactions.
Any thoughts on this is greatly appreciated.
Thanks in advance
View 3 Replies
View Related
May 28, 2008
Dear all,
we have tables with many image columns. We fill these image columns via ODBC and SQLPutData as described in MSDN etc (using SQL_LEN_DATA_AT_EXEC(...), calling SQLParamData and sending the data in chunks of 4096 bytes when receiving SQL_NEED_DATA).
The SQLPutData call fails under the following conditions with sqlstate 08S01
- The database resides on SQL Server 2000
- The driver is SQL Native Client
- The table consists e.g. of one Identity column (key column) and nine image columns
- The data to be inserted are nine blocks of data with the following byte size:
1: 6781262
2: 119454
3: 269
4: 7611
5: 120054
6: 269
7: 8172
8: 120054
9: 269
The content of the data does not matter, (it happens also if only zero bytes are written), nor does the data origin (file or memory).
All data blocks including no 7 are inserted. If the first chunk of data block 8 should be written with SQLPutData the function fails and the connection is broken. There are errors such as "broken pipe" or "I/O error" depending on the used network protocol.
If data no 7 consists of 8173 bytes instead of 8172 all works again.
(Changing the 4096 chunk size length does not help)
Has anybody encountered this or a similar phenomenon?
Thank you
Eartha
View 7 Replies
View Related
Oct 7, 2015
I have a table called employee_punch_record that we use to store employee time clock punches.
The columns are:
employeeid,
punch_timestamp,
punch_type (In / Out),
closed (bit used as status for open or closed pay periods),
ident
Here are some examples of a record:
bkingery62015-10-06 16:59:04.000In0
bkingery72015-10-06 16:59:09.000Out0
bkingery82015-10-06 16:59:13.000In0
bkingery92015-10-06 18:22:44.000Out0
bkingery102015-10-06 18:22:46.000In0
bkingery112015-10-06 18:22:48.000Out0
bkingery122015-10-06 18:22:51.000In0
tfeller52015-10-05 17:00:05.000In0
We are using SQL Server 2008 as our database and use Access as a GUI. I am looking to create a form in Access where employees can access their time card and request changes from management. I want to use the format from the attached screen shot for the form. I pretty much know how to do it all, the only point of complication is trying to figure out the easiest way to get the transaction punch record data on employee_punch_record into a format where I can easily populate the form in the horizontal format you see in the screen shot.
I am not super strong in SQL, but figure I can do it using a formatting table of some sort. quick and easy way to move transaction records into a more horizontally oriented record?
View 0 Replies
View Related
Aug 7, 2006
Dont laugh;
How do I create a simple sqlcommand in C# that shows data. I have the code for VB but I a missing something in the converstion. I know SQL but I dont get the simple steps of displaying data. I have got all of the Visual Basic stuff down I just need help with doing it by hand in C#.
or point my to a URL so that I can get the code.
Thanks
View 1 Replies
View Related
Jun 30, 2007
Hi all, this is a very basic question of diplaying a data. on my aspx page I have datasource that will return only ONE record.
<asp:SqlDataSource ID="sdsCategoryName" runat="server" ConnectionString="<%$ ConnectionStrings:KaruselaConnectionString %>" SelectCommand="SELECT Title FROM tbh_Categories WHERE CategoryID=@categoryID "> <SelectParameters> <asp:QueryStringParameter DefaultValue="-1" Name="CategoryID" QueryStringField="id" Type="int32"/> </SelectParameters> </asp:SqlDataSource>
on the server side I would like to manipulate the title of the page according to the data returned from the query:
and on the behind code if (!this.IsPostBack && !string.IsNullOrEmpty(this.Request.QueryString["ID"]))
{
DataView dv2 = (DataView)sdsCategoryName.Select(arg);
this.Title = string.Format(this.Title, dv2.Table.Columns[0].ToString());
dv2.Dispose();
}
of course it doesn't work. my question is this. do we really have to put the query datasource on the client side?and secondly, how can I view the recorsd I recieves from the query?Thanks for the help.
View 1 Replies
View Related
Mar 10, 2008
Hi I have used the create user wizard to create a registration page my table stores the user details and user id. I am also using the login wizard to create a log in page . I now want to display the details of the currently logged in user usind details view and allow them to view and edit their details. where and how do i create the session varible anh how do I wtire the sql select statement say select first name from table1 where (the userid I stored earlier in a table when the user registered ) = (this should be the currently logged in user'id). I am a novice so I would appreciate code snippets
My code in asp page for the details looks like this
asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="SqlDataSource1"
Height="50px" Width="125px">
<EditRowStyle BackColor="#CCFF99" />
<AlternatingRowStyle BackColor="#FFCCFF" />
</asp:DetailsView><asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>"
SelectCommand="SELECT [FirstName], [LastName], [City], [Listing] FROM [UserDetails] WHERE ([UserId] = @UserId)">
</asp:SqlDataSource>
novice This shows no data when I test it. I have tried the folling in the .vb page no luck.
Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound
Dim UserId As Integer = Me.DetailsView1.DataItem("userID")Session("_UserID") = UserId
End Sub
View 5 Replies
View Related
Jun 15, 2007
Hi. Not sure which section this request needs to be put in, but i'm relatively new to SQL.
I have 1 table which contains an user_id (autonumber), user_name, and user_profile.
I have 2 other tables:
config_version (cv) and config (c)
These two tables both access the user table (us) to view the user_id (which is required).
I want to be able to view the user_names for both "cv" and "c" on a seperate page. Using the code below, i'm lost. I created what i wanted in MS Access with the use of a 2nd table (this might be easier to understand than my rant above). However, I don't want a 2nd table.
Can someone provide me with a function, or the "answer" to my problem?
Highlighted Blue - just there to fill in the front page with data (not wanted)
Highlighted Green - doesn't work, but was my first attempt
Code:
public function ShowQuotes
Dim objConn
Dim objADORS
Dim strSQL
Dim row
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = strConn
objConn.Open
Set objADORS = CreateObject("ADODB.RecordSet")
strSQL = "Select top 50 "
strSQL = strSQL & " cv.config_version_id as cvid, cv.configuration_id as cid, cv.version_number as cnum"
strSQL = strSQL & ", cv.status as cstat, cv.total_price as cprice, cv.modification_date as cmod, cv.version_description as cvrem"
strSQL = strSQL & ", c.remarks as qrem"
strSQL = strSQL & ", p.prod_description as pdesc, p.version as pvers, p.status as pstat"
strSQL = strSQL & ", cust.customer_name as custname"
strSQL = strSQL & ", us.user_nt_login as modname"
strSQL = strSQL & ", us.user_name as usname"
' strSQL = strSQL & ", cv.user_id as modname"
strSQL = strSQL & " from tbl_config_version as cv, tbl_configuration as c, tbl_product as p, tbl_user as us, tbl_customer as cust"
strSQL = strSQL & strWhere 'SETS RESULTS TO BE UNIQUE
strSQL = strSQL & " and us.user_id = c.user_id"
strSQL = strSQL & " and cv.configuration_id = c.configuration_id"
strSQL = strSQL & " and c.product_id = p.product_id"
strSQL = strSQL & " and c.customer_id = cust.customer_id"
strSQL = strSQL & strOrderBy & ";"
Image: www.mcdcs.co.uk/TT.jpg
View 1 Replies
View Related
Feb 7, 2008
In sql server, multiple instances of data default to a row display or vertical. I need a set of data in sql2005 to view horizontally so I can us it in a crystal report. Here is my issue.
gift.HonorKey, gift.HonorName, gift.HonorId
1211 Smith 1222
1244 Owens 4155
I need for the data to read like this:
HonorKey1, HonorKey2, HonorName1, HonorName2, HonorId1, Honorid2
1211 1244 Smith Owens 1222 4155
the table name is gift_view
I would like to be able to create a view in sql analyzer, then save as an SQL View
My direct email is jackfam@comcast.net
View 3 Replies
View Related
Oct 1, 2007
I'm sorry if this is a stupid question, but this is my first matrix report.
I am using a stored procedure that generates the following data:
Item Color Size Qty
Shorts Tan 32 0
Shorts Tan 34 2
Shorts Tan 36 2
Shorts Tan 38 0
The matrix displays as follows:
34 36
Shorts Tan 2 2
I would like it to display as follows:
32 34 36 38
Shorts Tan 0 2 2 0
It seems that by default (I used the wizzard to create the report) that the zeros are being suppressed. How can I get them to display?
Thanks
View 7 Replies
View Related
Mar 23, 2007
i m trying to display data from cursor.. but i think i m wrong wth the syntax..
i m doing tht in procedure..
i think dbms_output:put_line dsnt work in sql 2000 ..or may b a problem of Print statemnt instead.
help me out..thx in advance
View 5 Replies
View Related
Jul 20, 2005
Hi,This is driving me nuts, I have a table that stores notes regarding anoperation in an IMAGE data type field in MS SQL Server 2000.I can read and write no problem using Access using the StrConv function andI can Update the field correctly in T-SQL using:DECLARE @ptrval varbinary(16)SELECT @ptrval = TEXTPTR(BITS_data)FROM mytable_BINARY WHERE ID = 'RB215'WRITETEXT OPERATION_BINARY.BITS @ptrval 'My notes for this operation'However, I just can not seem to be able to convert back to text theinformation once it is stored using T-SQL.My selects keep returning bin data.How to do this! Thanks for your help.SD
View 1 Replies
View Related
Mar 11, 2008
The ERP manufacturer used an image data type to store large text data fields. I am trying to move these data types from one database to another database using either Sql Queries or MS Access. I can cast them as an 8000 char varchar to read them directly but have no luck importing into these image data fields.
Access and Crystal are not able to read these fields directly.
Any suggestions? Most information about these fields has to do with loading files but I am just moving data.
Thanks,
Ray
View 1 Replies
View Related
Jan 29, 2008
Im trying to display data from a database based on an input value. The value in the Label12.Text which is("hotmail") is the input value thats stored in the database, this value is been searched for in the strSQL.
Dim strSQL As String = "SELECT Name FROM Jobseeker WHERE Email='" & Label12.Text & "' "
strSQL = Label5.Text
the code builds successfully, but Label5.Text appears blank.
View 2 Replies
View Related
Feb 21, 2008
Hello, Im new to SQL. Im currently having a table called Daily with 5 columns. TesterNames,Activity,Hours_given,Hours_used and Delta. I have grabbed the data for the first three colums from another table called Tester. For Hours_used I supposed to get the data from another server after i get the access but mean time i just put my own data so that i can check the value of Delta. Data for Delta column should be as below.
Delta = Hours_given - Hours_used
So How do I do the codings for this expression and display it in the same table. Output I need as below:
TesterNames Activity Hours_given Hours_used Delta
abc A 5 6 -1
def B 7 6 1
I have used
INSERT INTO Daily ( TesterNames,Activity,Hours_given)
SELECT ( Tester_ID,Weekday_Day,EntityWDD)
FROM Tester
and the first 3 columns are filled with the data needed. But when I use
INSERT INTO DAILY(Delta)
SELECT Delta = Hours_given - Hours_used FROM DAILY
The output was like below
TesterNames Activity Hours_given Hours_used Delta
abc A 5 6
def B 7 6
Null Null Null Null -1
Null Null Null Null 1
Help me . thank you.
View 2 Replies
View Related
Apr 22, 2006
Everything works great on my development box. I am using GoDaddy for production (ASP.Net v2, SQL 2000).
I am not receiving any errors, so I am stumped; no data from the database is displaying on the GoDaddy pages.
I updated the connection string in web.config to this:
< add name="snsb" connectionString="
Server=whsql-vXX.prod.mesaX.secureserver.net;
Database=DB_42706;
User ID=username;
Password=pw;
Trusted_Connection=False" providerName="System.Data.SqlClient" / >
But I am unsure if this is the issue?? Any insights? This is the page I am working on: www.sugarandspicebakery.com/demo/bakery/default.aspx. So, the page displays fine, but it should be showing data from the database. This particular page uses a DataList with ItemTemplate. There is definitely data in the database, and I have even ran the same exact query from the code using the Query Analayzer on GoDaddt and it returned results
I know there isn't much info to go by, but I am hoping someone has some insight since I have been trying to figure this out for days now!
Thank youJennifer
View 2 Replies
View Related