hericles 289 Master Poster Featured Poster

You would only want a singleton class if the information being supplied by the web service is the same for everyone.
Having multiple business logic instances created (one per user) isn't (shouldn't be) an issue. That is how web servers are designed to work. Its the same as the server serving up multiple versions of the same web page when a lot of users are viewing the site. Unless your instances take up a lot of memory but thats different issue.

hericles 289 Master Poster Featured Poster

Data.CommandBehavior.CloseConnection returns an enumeration (the number 6 from what I just looked up on MSDN). This means you are in effect calling

Dim result As Data.SqlClient.SqlDataReader = dr(6)

Which probably doesn't exist as your dr has 6 items or less. As you already have the dataReader set up I'm not even sure why you are creating another dataReader equal to the existing one just to see if it has rows.

hericles 289 Master Poster Featured Poster

Try setting the autoGenerateColumns property of the data grid to false.

hericles 289 Master Poster Featured Poster

What code you are referring to exactly? If you post up code on a webpage as a tutorial or similar then yes, it will get used by other people if its any good.
If you are referring to production code getting screen scraped I'm not sure how that would happen. Server side code can't be screen scraped as it isn't part of the page source. The only code that could be stolen like that is javascript but if you're worried about that then link to an external .js file rather than add javascript directly to the HTML.
Or have I missed th point of your post entirely?

hericles 289 Master Poster Featured Poster

"some data" would be whatever you wanted to store in the session variable. It could the user ID, their email, name, anything.
You place the code where ever you have your log in authentication code. If you have a log in button where you check the user name and password are correct that would be ideal. After you have verified the user you can set the session variable to indicate they have logged in successfully.

hericles 289 Master Poster Featured Poster

I'm not sure what the actual limit is (although I think I once read it was a year) but you wouldn't want to have it more than an hour or two surely. If you set it to a very long time you're going to be wasting a lot of server memory with session variables that aren't even being used anymore.

hericles 289 Master Poster Featured Poster
hericles 289 Master Poster Featured Poster

When your user logs in create a session variable that holds the user_id (or whatever defining information you want) like this:

Session["user_id"] = "some data";

Then you can access that at anytime during the user's session with this

String user = Session["user_id"].ToString();
hericles 289 Master Poster Featured Poster

Here is what I did to make the 3 sections display beside each other;
take out the extra DIV around the contact form,
shrink the width of the object down from 100% to 70 or 75 (whatever works best for the size of the object being embedded)
move the object DIV to be above the contact form in the HTML
set the object CSS to include display: inline-block
make the contact-from CSS include float: right;

Hope that helps.

hericles 289 Master Poster Featured Poster

Try using the getString() method of the reader with the column number. E.g.

logID = dr.getString(0)
PassW = dr.getString(1)
hericles 289 Master Poster Featured Poster

You will want to look into installing and using the AJAX control kit for your version of Visual Studio (I think the 2010 version differs from 2008 but I could be wrong). Then it is just a matter of setting up the control kit on the page and specifying which functions of your server side code will be supplied via AJAX.
Its pretty simple to set up and use. Auto complete examples using the control kit as all over the net too.

hericles 289 Master Poster Featured Poster

Is the name of you unit moduleconnectionstring correct in your config file? It looks like, for the some reason, the connection isn't being returned. Easiest thing to do is debug the function that calls the string and see what the output is.
Also, as you're dealing with unfiltered user input, using parameters in your query statement is OK. You should never give the user the ability to type text that will end up being directly entered into a query (it called SQl injection).
Well spotted with the copied parameter names, Skatamatic. Copy and paste gets us all at some point:)

hericles 289 Master Poster Featured Poster

You can see your mistake in the error message. Pay close attention to the quotes and you'll see you aren't placing them in the correct positions.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tests,'20120508,'5.5,'20120508)' at line 1

You have (Test, '20120508, '5.5, '20120508). You missed the closing quote in three places.

hericles 289 Master Poster Featured Poster

I'm assuming the text box is going to show more information than you have already extracted from the database i.e. another SELECT statement is needed.
You can improve the usability by removing the radio button and using a link button for the name. Then the user just needs to click the name for the code to execute. The link button can call another SELECT statement using its command object, which you set to be equal to the customer's name.
If you want to stay with the radio button you will need to iterate through the grid view rows looking for all radio button types until you find the selected one and then get the value of the next column of the current row and then use that to get the new information.

Does that make sense?

hericles 289 Master Poster Featured Poster

Well, the web.config file is just an XML file. You can open it and alter the contents the same way you could to any other file. You can use a regular expression or path to locate the password in the file, overwrite it and save the file again.

hericles 289 Master Poster Featured Poster

The data reader is a forward only way of moving through the data extracted. You can use other types if you want to be able to arbitrarily select a position. The dataTable can be referenced by iterating through the rows so moving back forward is easy.

hericles 289 Master Poster Featured Poster

Go to your project in the explorer and right click, you'll see the menu item 'add reference'. In the window that opens up browse to the DLL you you need and click OK. Once the DLL is referenced add a using statement to your class.

hericles 289 Master Poster Featured Poster

OK, if you have declared your connection string as a string you would access like this:

Dim connectionString As String()
    connectionString = 'your connection string'
    Dim conn As SqlConnection = New SqlConnection(connectionString)

If you have entered your connection string into the code then you don't need to use the configuration manager as the connection isn't located in the app.config file.

If you have added the connection string to th app.config file you will have a section that look like this:

<?xml version='1.0' encoding='utf-8'?>
    <configuration>
    <connectionStrings>
      <clear ></clear>
      <add name="Name" 
       providerName="System.Data.ProviderName" 
       connectionString="Valid Connection String;" ></add>
    </connectionStrings>
    </configuration>

Now you can use the configuration manager to locate the element with the name 'Name' (for example).
If you are having trouble with the idea of app.config files and the storing of connection strings I would suggest typing '.net app confg connection string' into google and reading the MSDN articles that come up.

Hope that helps,

hericles 289 Master Poster Featured Poster

If you want to store your connection string in the app.config or web.config you normally place in the correct section and give it a name. You then use the ConfigurationManager to locate the connection based on the name. You haven't done that. In essence you have told it to look for an element named "Data Source=./SQL... etc" which doesn't exist.
Either declare it as a string in code or correctly place it in the config file and search for it by its name.

Dim conStr As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("your_name_goes_here").ConnectionString)

hericles 289 Master Poster Featured Poster

ZeroZen is right in his answer. If you can move it all to server code managed (and called) directly by the aspx page then do it.
A web service can work just as well, better in fact if you want different websites/services to call it. Your webpage calls the web service, sending its data and gets the result back as JSON or similar.

hericles 289 Master Poster Featured Poster

Does your dataGridView have at least 4 rows and columns? It may be that it is crashing because position (3,3) doesn't exist.

hericles 289 Master Poster Featured Poster

You can store name/value pairs in session state very easily. Once you have logged in a user you can set the ssions variable like this:
Session["loggedIn"] = "true";

You can then later alter the session variable or check it for logged in status. In your global.asx file you can specify any session variables you are going to use by setting them up in the session_start section.

I hope that helps.

hericles 289 Master Poster Featured Poster

If you want to get all of the rows out of a database for a particular column use either a dataReader or a dataAdapter to hold the result of your SQL statment (SELECT column_name FROM database;) and then loop through the reader or adapter adding each item to the combo box.

Is there a particular part of the problem you are having trouble with?

hericles 289 Master Poster Featured Poster

You haven't added your HTMl so its hard to actually see what is wrong but if you have a <DOC> declaration below your aspx page and register directives it should be detected.

Actually, are you passing the validator the actual aspx file or validating the page online (passing the URL)? Because that will make difference to what the validator sees, server side code not appearing online of course.

hericles 289 Master Poster Featured Poster

If you view your page source is the control showing in the HTML? Any part of it at all?

hericles 289 Master Poster Featured Poster

Which line is throwing the error?
MSDN says an InvalidCastException can be thrown when you try a conversion from a Single or a Double to a Decimal, the source value is infinity, Not-a-Number (NaN), or too large to be represented as the destination type.
Could it be the divide part can't handle a decimal value or you have a zero in there as a start value?

hericles 289 Master Poster Featured Poster

If I understand you correctly you want to be able to display a PDF on screen in a browser and have a user enter comments. The first part is easy, browsers display PDFs naturally so you just link to the PDF. To have the PDF and the ratings/comments section on screen at the same time link the PDF to an iFrame and have the comments below it (or above it). Then you can have both things on the one page and easily viewed by the user.

rogerg commented: thx, I'll give it a try +0
hericles 289 Master Poster Featured Poster

You're looping through item1 and item2 to compare each item but then actually comparing DDL.SelectedItem against LBX.SelectedItem (which is the same comparison each time). You should be comparing item1 against each item2 or DDL.SelectedItem against item2 and then removing if they are the same.

hericles 289 Master Poster Featured Poster

browser was second on the list;) Why not branch out into another coding language if VB.Net is too easy? Learn Ruby on Rails or get good at Java, objective C maybe?

hericles 289 Master Poster Featured Poster

Try putting single quotes around your inputs.

katherinedamon commented: thku man +0
alokrocks94 commented: what do u mean by single quotes i am not getting can u write the correct syntax for this example? +0
hericles 289 Master Poster Featured Poster

To generate barcodes you can use free3of9 barcode font. Its completely free and I've used on several projects to create scanner readable barcodes.

hericles 289 Master Poster Featured Poster

SELECT * FROM table_name ORDER BY rand()

Note that this is apparently intensive on the server due to the way random works. You maybe better off to extract the data and randomize in code, especially if you want to output it in a particular way.

Kniggles commented: :@) ty +1
hericles 289 Master Poster Featured Poster

Firstly you start a new thread (button at the top of the page) so you're not hijacking someone else's, its considered impolite. Then we help you:)

hericles 289 Master Poster Featured Poster

Double check what your constr is holding after your have created it.

hericles 289 Master Poster Featured Poster

Do you need the two dataTables? It sounds like you could alter what you extract from the database to include eveything you need. If that isn't possible you can use the Merge method to merge two dataTables with differing schemas. That should help. The MSDN articles are pretty useful for that.

hericles 289 Master Poster Featured Poster

javascript is the easiest solution if you simply want to print exactly what is on screen.
include a link (or button) somewhere on the page that looks like this:

<a href="javascript:window.print()">Print page</a>
JorgeM commented: simple, yet effective advice! +3
hericles 289 Master Poster Featured Poster

If I understand the question you aren't looking for the results that could be value 1 OR value but those results that include value 1 and 2. If you have got the values in an array you can append them all to one SQL statement using the AND clause. E.g.
SELECT * from some table WHERE col = value1 AND col2 = value2 etc...

The result will be the rows that match all of the criteria.
Otherwise you can extract out the rows matching value 1 and store them in a dataTable and run filtering queries against that using LINQ. This might be better depending on exactly what you need to filter and the structure of the data.

hericles 289 Master Poster Featured Poster

We can't help you with these questions without knowing depth what you are you are trying to do. You need to make the decision based on your requirements and what information you want to save and use. If you want to be able to link products to certain categories then yes, you will need a data store that allows you to do that.

hericles 289 Master Poster Featured Poster

Hi,
Your question isn't very well worded. But I'm guessing you are asking what database tables should make up your database. That depends entirely on what data you are trying to capture. Generally you would give the table a name that descriptively explains what the table stores whilst keeping it short. So if you had an application that recorded customers and their orders you would have tables for Customers, Products, Orders and at least one more for recording the individual items that make up an order.
Does that make sense?

hericles 289 Master Poster Featured Poster

If you want to do it with .net use a compare validator control connected to the date of birth textbox. The .net validators can be set to use client side validation for a fast response (server side validation still occurs if the client side validation passes however).

hericles 289 Master Poster Featured Poster

Use more than one thread. Then you can use thread.sleep on the thread doing the work but leave the main thread active.

hericles 289 Master Poster Featured Poster

But what you will find when you Google are answers that handle part of what you are trying to achieve. Break it down into the steps:
Determine which radio button is clicked
read data from a control (your textbooks)
write to file

Each of these things can easily be googled and then put together to give you your complete answer.

hericles 289 Master Poster Featured Poster

Use a repeater control if you want the output to be in HTML table format.

hericles 289 Master Poster Featured Poster

One of your inputs is too long for the corrosponding column in the database, check the allowable lengths for them all to see which one is the problem.

As for your first question, what is an effective AJAX table? What are you trying to do?

hericles 289 Master Poster Featured Poster

Do it client side with javascript. Add an onclientclick event and then alter the css class the element is pointing to.
Your HTML:
div id="menu1' class="Menu_On"><asp:LinkButton ID="Link_Menu1" runat="server" onclientclick='changeCSS(1);'>Menu 1</asp:LinkButton></div>
div id='menu2' class="Menu_Off"><asp:LinkButton ID="Link_Menu2" runat="server" onclientclick='changeCSS(2);'>Menu 2</asp:LinkButton></div>
div id='menu3' class="Menu_Off"><asp:LinkButton ID="Link_Menu3" runat="server" onclientclick='changeCSS(3);'>Menu 3</asp:LinkButton></div>

Your javascript:
function changeCSS(number) {
document.getElementById('menu1').className += "Menu_Off"; // set them all to off
document.getElementById('menu2').className += "Menu_Off";
document.getElementById('menu3').className += "Menu_Off";
var menu = 'menu' + number;
document.getElementById(menu).className += "Menu_On"; // reset correct menu to on - yes, its a lazy way to do :)
}

You only mention 3 menus but if you have more the javascript function can be made more dynamic. You should be able to get the idea anyway. A loop could be used to run through them all to set them to false.

OK, I don't see how to indent code lines any more...

hericles 289 Master Poster Featured Poster

what code do you have in the page_load event? if you are reloading the same page and need to skip around code that would normally fire you can use
if(!Page.IsPostBack) {
// run code here
}

hericles 289 Master Poster Featured Poster

If your string is always going to be of the format MMM-yy then you can split it on the '-' character and reform it as you require it

hericles 289 Master Poster Featured Poster

800 x 600 is limiting yourself these days, most users have a larger screen (at least 1024 x 768). You can actually check the percentages of users that use certain screen resolutions online. Currently 1% of users use 800x600, 13% use 1024x768 and the rest are higher (source: w3school)
The appropriate number of categories is going to depend on the products you want to list and how easy it would be for the user to locate the categories they want. For example, if you sell everything under the sun one category for Books is probably fine, if all you sell is books then you would need to break that down.

hericles 289 Master Poster Featured Poster

I was assuming not because the line

grp.NamaGroup = TextBox_nama.Text;

But you could be right.

hericles 289 Master Poster Featured Poster

What accessibility have you set for NamaGroup? Is it visible to this class?