I found what was the problem. It seems that I had some issues with parsing the file type and it exceeds to 51 characters, my mistake.

Hello adam,

As I have said on my description, I have a filter on each varchar columns so it won't exceed in its limits. I am 100% sure that the problem was not on those varchar fields.

I also tried setting a constant values on each column except for id and filebytes, since id is Identity, and filebytes came from a filestream.


I had a problem uploading or adding a file on the database and shows the error stated on the title.
The column holding the binary data was set to varbinary(MAX). I couldn't find what was my error because I was able to upload a 900kb MS Word Document but it fails on a 51kb file.

By the way, here is my table format.

fileid      int
filetype    varchar(50)
filename    varchar(50)
filebytes   varbinary(MAX)
fileext     varchar(10)
posted      datetime
uploader    varchar(50)

I have a filter on each varchar fields so it won't produce an error.

Please help.


Sure it is... This is technique i have used when building a captcha solution. I generate the image using random numbers and background lines in an aspx page, then on the page that contains the image control, I reference the captcha aspx page using the ImgURL attribute.

I know how to run that code on images, I actually got the idea of my problem from that. Maybe you misunderstood my explanation. =P

The idea is to get a string of characters from another asp.net page via "primary key" that will be retrieved by Request.QueryString, and pass it on a control that can hold a text, or even a simple <p> tag.

I'm still thinking and browsing over the web for some topic on how to do that on text.

I will be using it on a "forum-like" asp page. I am using a Datalist control to list all forum categories. The part that I am asking will be used on who are the people administrating the page, somewhat like that.

Is it possible to retrieve a text from a URL or page content by using something like ImageUrl property on the Image Control?
Ex in image:
<asp:Image runat="server" id="Image1" ImageUrl="getImage.aspx?id=2" />

Let's say I have this code on getText.aspx

Imports System.Data
Imports System.Data.SqlClient

Partial Class getText
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim theid As Integer = Request.QueryString("id")
        Dim con As New SQLConnection(ConnectionString)
        Dim cmd As New SqlCommand("SELECT somefield FROM sometable WHERE id=" & theid)
        Dim sda As New SqlDataAdapter(cmd)
        Dim ds As New Dataset


        If ds.Tables(0).Rows.Count > 0 Then
            Response.Write( ds.Tables(0).Rows(0).Item("somefield").toString )
            For i = 1 To ds.Tables(0).Rows.Count - 1
                Response.Write(", " & ds.Tables(0).Rows(i).Item("somefield").toString)
        End If
    End Sub
End Class

and having this database struture on the database,

  id              somefield
  1               student1
  2               student2
  2               professor1
  3               professor2

Assuming that example is running on Label:
<asp:Label runat="server" id="Label1 TextUrl="getText.aspx?id=2" />

Label1.Text = "student2, professor1"

I know how to do it on javascript but I don't know how on ASP.NET
It is something like

<script src="getText.js" type="javascript"></script>

I will be using it on Datalist's item template

Please help,

Sorry for my poor english.

It works! You're a genius mate!


I am having trouble with retrieving records on my database.
My layout was this..


The first text are the table names while the indented once are the field names.
I have a table named Records. TheUser and ApprovedBy was referring to the Username under the UsersList table.

Now my problem was, when I retrieve the records by aliases. I need to use the first name and last name of the users to generate report.



1/22/2012 4:53:00 PM
If I will use this query, it will just show similar record.

[CODE]SELECT (LastName + ', ' + FirstName) AS theTrainee, (LastName + ', ' + FirstName) AS PersonInCharge FROM UsersList
INNER JOIN Records ON UsersList.Username = Records.theUser[/CODE]

[CODE]theTrainee PersonInCharge
Zip, Michael Zip, Michael

What I need is
theTrainee PersonInCharge
Zip, Michael Holmes, Christian

Any Ideas?

I found what was the problem.
I tried changing [CODE]document.getElementById('sheetNo').innerHTML+="<option value=\""+ i +"\">"+(i+1)+"</option>"[/CODE]

to[CODE]var opt = document.createElement('option');
opt.value = i;
opt.innerHTML = parseInt(i + 1);

and it works.

Hi twiss,

Thanks for the reply. It does not work either. What I did was I called the function on body tag, like this.[CODE]<body onload="startup()">[/CODE][CODE]function startup(){
//load startup functions
When I tried to prompt the values I need, it executes it correctly. I also tried prompting a dialog box inside the loop on getSheetCount function and it shows the value correctly. I think the problem was on this code. [CODE]document.getElementById('sheetNo').innerHTML+="<option value=\""+ i +"\">"+(i+1)+"</option>"[/CODE]

I tried entering this code before the loop, and it does not show anything. Even inside the function startup(); [CODE]document.getElementById('sheetNo').innerHTML = "<option value='Sample'>Sample</option>";[/CODE]

Hi. I don't know where the problem is. The next codes is working on Google Chome but not in IE. I haven't tested yet on Firefox.

[CODE]function getSheetCount() {
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
        var txt = xmlhttp.responseText;
        for(i=0; i<parseInt(txt); i++){
            document.getElementById('sheetNo').innerHTML+="<option value=\""+ i +"\">"+(i+1)+"</option>";


require_once 'Classes/PHPExcel.php';
$inputFileName = 'rf1.xls';
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
echo $objPHPExcel->getSheetCount();

[CODE]<label>Sheet no:</label><select name="sheetNo" id="sheetNo"></select>[/CODE]

I tried prompting a dialog box on getSheetCount and it shows this error

[QUOTE]Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C)
Timestamp: Mon, 23 May 2011 09:52:49 UTC

Message: 'document.getElementById(...)' is null or not an object
Line: 152
Char: 5
Code: 0
URI: [url]http://localhost/final/javascript/functions.js[/url][/QUOTE]

By the way, I am using Internet Explorer 8.

Please help me,

I will use the example above, Fe + Cl2 = FeCl3

Fe on left hand side has 1 atom, same with the right hand side so they are equal.
Cl on left hand side has 2 atoms, and 3 atoms on the right hand side.
To make Cl equal, I am adding 3 more Cl on left hand, and 2 on the right hand so that makes [B]Fe + [U]3[/U]Cl2 = [U]2[/U]FeCl3.[/B]
They aren't balance yet since Fe on the left hand side has only 1 atom while Fe on the right hand side has 2 atoms. Now to make it balance, I am adding another two on the left, so that makes [B][U]2[/U]Fe + [U]3[/U]Cl2 = [U]2[/U]FeCl3[/B]

Can you help me how to balance a chemical equation using linear algebra. I know how to do it on a piece of paper using the usual method of balancing. I just don't get the principle how to do it on the other method.

Please give me a step by step procedure on how to do it, the basic ones.

This is how far I have gone.
Ex: Fe + Cl2 = FeCl3

Set a variable for each
[A]Fe + [B] Cl2 = [C] FeCl3

Count the number of coefficients
Fe: A = C
Cl: 2B = 3C

And I'm stuck with here. I don't know how will I get 2Fe + 3Cl2 = 2FeCl3 (the correct answer)

If you have a better/easy one, can you please post it here. I need to create a program that will balance a given equation. I don't have a problem anymore on extracting the values, chemical symbols, and coefficients. My professor gave me until May 10 to do this so I need a quick response.

Hoping you could help me,

Stupid me, Msgbox returns a value, and any expression does.
Is there a way I can delete this post?


I just want to ask if it is possible to create a function that accepts an expression into its arguments. Just like what IIF do.
[CODE]Dim strResponse as String = IIF(Msgbox("Select Yes or No", vbYesNo) = vbYes, "Yes", "No")[/CODE]
I forgot the code, but its the thought that counts.

Anyway, is it possible? If it is, how?



Thanks for the reply. What if I have a ProductID of G01, G02, GX01,GX02, JG01, JG02 and I want to update G## ID's and use LIKE '%G%'. It will update G## but it will include GX and JG. I just thought of that before.



I have this table named tblProduct, which contains fldProductID, fldProductName, fldValue
fldProductName contains its name, and fldValue contains how much is the product cost.

Now I am having trouble with updating fldProductID.
Here's what my fldProductID look like.

Its format is [ProductPrefix][ID]
When ProductPrefix is deleted, all of the productID containing that prefix will be deleted.
For example GZ from ProductPrefix was deleted, GZ01 and GZ02 will be deleted. I don't have a problem with that.

The problem is the Update, when I changed the ProductPrefix, from GZ to GZX, the records from fldProducts will be updated too. GZ01 will become GZX01 and GZ02 will become GZX02.

I have one solution regarding that but it is NOT efficient to use, like if you have thousands of records affected. Each item will be selected by using...
[CODE]SELECT fldProductID FROM tblProduct GROUP BY fldProductID HAVING MID(fldProductID,1,Len(Prefix)) = 'SOMEVALUE'[/CODE]
... and then will apply the UPDATE query ONE by ONE.

What I am thinking/asking is, is it possible to USE a single line query for this? Like,
[CODE]UPDATE tblProducts SET fldProductID='<NEWVALUE>' WHERE MID(fldProductID,1,Len(Prefix)) = 'SOMEVALUE'[/CODE]

Please help,


That helps! I didn't know about that "IN", I should explore more on SQL. Thanks a lot!


Hi. I'm having a problem on deleting a record using a function on SQL.
DELETE FROM tblServices GROUP BY ServiceID HAVING MID(ServiceID,1,2)='SG'

This query shows and error saying: Cannot group on fields selected with '*'.
I tried adding a specific field, like this:
DELETE ServiceID FROM tblServices GROUP BY ServiceID HAVING MID(ServiceID,1,2)='SG'
but it shows the same result.

Please help me.

I tried creating a Database1DataSet.xsd contaning the tables & fields needed (BorrowerInfo., BookInfo., StudentInfo.*) but it shows no record. Just the Column Headers

Hi! I was able to get what I needed, thanks everyone. But recently, I have a problem showing it to a CrystalReport. It was working on DataGridView and tested it on ListView object.

Here's my code on throwing it to a Crystal Report

[B]Button1 Procedure[/B]
[CODE]Dim ds As New DataSet
Dim cr As New CrystalReport1

ds = getInfo("SELECT BorrowerInfo.StudentID, BorrowerInfo.BookID, BookInfo.Title, StudentInfo.FullName FROM BookInfo INNER JOIN BorrowerInfo ON BookInfo.BookID = BorrowerInfo.BookID INNER JOIN StudentInfo ON BorrowerInfo.StudentID = StudentInfo.StudentID", "1")

frmReport.CrystalReportViewer1.ReportSource = cr

[B]Connection Module[/B][CODE]
Private sqlConn As SqlConnection
Private sqlDataAdapt As SqlDataAdapter

Private Const strSqlConnection As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True"

Public Function getInfo(ByVal strSql As String, ByVal strTable As String) As DataSet
Dim dsReturn As New DataSet
sqlConn = New SqlConnection(strSqlConnection)

sqlDataAdapt = New SqlDataAdapter
sqlCmd = New SqlCommand(strSql, sqlConn)
sqlDataAdapt.SelectCommand = sqlCmd
sqlDataAdapt.Fill(dsReturn, strTable)

Return dsReturn
End Function


It always show this dialog.

Please help me

Thanks for the reply everyone and I'm sorry I wasn't able to response immediately. If I am not mistaken, to show the books borrowed by a specific student, my query would be.

[QUOTE]SELECT BorrowerInfo.StudentID, BorrowerInfo.BookID, BookInfo.Title, StudentInfo.FullName
FROM BookInfo
INNER JOIN BorrowerInfo ON BookInfo.BookID = BorrowerInfo.BookID
INNER JOIN StudentInfo ON BorrowerInfo.StudentID = StudentInfo.StudentID
WHERE StudentID = '2938485';

Hi, I'm quite new with Data Adapter on VB.NET. I'm having a problem with retrieving data on different tables.

Example database:
[QUOTE][B]BookInfo[/B][INDENT]BookID: HSD993Z
Title: Introduction to SQL[/INDENT]

Title: Advance Computer Programming[/INDENT]

Title: Object Oriented Programming[/INDENT]

[INDENT]StudentID: 2938485
FullName: Michael Zip[/INDENT]

[INDENT]StudentID: 2949284
FullName: Ray Williams[/INDENT]

[INDENT]StudentID: 2938485

[INDENT]StudentID: 2938485

To get all the list of the Students who borrowed books, the query would be
[CODE]SELECT StudentInfo.FullName, BookInfo.Title
FROM BookInfo, StudentInfo, BorrowerInfo
WHERE BookInfo.BookID=BorrowerInfo.BookID AND StudentInfo.StudentID=BorrowerInfo.StudentID;[/CODE]

Now the Fill method on DataAdapter has a parameter of DataSet and SourceTable.
I'm confused on SourceTable, should I write all of the tables I used?
Ex: SourceTable = "BookInfo, StudentInfo, BorrowerInfo"

I can't show my reports.

I don't have problems with listing all records from one table.
Ex: "SELECT * FROM StudentInfo" and the TableSource is "StudentInfo"

Can you please help me?
Thanks in advance

Thanks for your reply. So this means LZW cannot compress most, but not all, multimedia files such as audio, video, and images?

Hi! I am currently using LZW algorithm for compressing files but it cannot compress multimedia.
What possible process am I missing? Is there any method be done before entering the algorithm?
Enlighten me please.

Any help will do.

Thanks in advance.