john.knapp 25 Posting Whiz in Training

If you can't ping the other IP address, you'll never get it to work...

  1. Turn off any firewalls on both computers
  2. Assign/Configure their IP addresses (DHCP, Static, Static DHCP, or Automatic Private IP Addressing)
  3. Ping each computer from the other, using the IP's you posted above - on computer #1 (with IPA = 192.168.1.1) your command would be ping 192.168.1.2; on computer #2 the command would be ping 192.168.1.1

If ping doesn't get a reply, then your "network" is not working.

john.knapp 25 Posting Whiz in Training

it is doing full table scan each time trigger is running

Doing a table scan, as in query analyzer says "Table Scan" or looking through the whole table to see if there's a matching phone number (btw, you'll want an index on that column if you don't already have one) - Because "Table Scan" is bad - see previous reference to LIKE keyword...

So, if I understand - even if the phone number is already in the data table, don't match unless it is in the last row?

If you just inserted that last row, and you have a primary key on that table, and you're in the same scope (with triggers, you should be), use scope_identity() to get the primary key, and use that in your WHERE clause. Something like this:

ALTER TRIGGER [dbo].[test_trigger1] on [dbo].[testinput]
AFTER INSERT
AS
SET NOCOUNT ON

DECLARE @LastIdentity int                      -- assumes default int datatype for your primary key
SELECT @LastIdentity = Scope_Identity()

INSERT INTO testoutput(name)
SELECT i.name
FROM   testinput i
INNER JOIN testdata d
ON i.phone LIKE d.phone
WHERE i.[YOUR_IDENTITY_COLUMN_NAME] = @LastIdentity
john.knapp 25 Posting Whiz in Training

If it's returning duplicate data, then you have duplicated values in whatever column you are defining your join on, in one table or both...

john.knapp 25 Posting Whiz in Training

I know truncate clears the table.
But I added a new empty row first, so I always have that.

Adding an empty row is not really a viable solution. There are a lot of strong words (none of them very nice, some much ruder than others) that come to mind if you were doing that to my production database! :)

Are there other options to avoid reading the first row of your table perhaps?

There is no first row after the Truncate Table statement.

How are you displaying your data? You could probably do something with the SelectedIndex, Text or whatever property.

john.knapp 25 Posting Whiz in Training

I'm pretty sure you can't make it read only the last row...

If you only want one row returned, then adjust your query accordingly.

By the way, never use a LIKE if you can avoid it - that will bring even the heftiest server to it's knees if there is enough data.

john.knapp 25 Posting Whiz in Training

Per a quick read at DigitalPersona.com, ftp is a legacy Fingerprint Template format, their newer formats are fid and fmd - with fmd being the enrollment data.

That same quick read did not tell me definitively what format their data is in, although they hint at it being an image that must not be compressed.

The SDKs at DigitalPersona.com should provide more information and hopefully answer your question.

john.knapp 25 Posting Whiz in Training

How do I set the if exists to actually match the phone number from data table, as opposed to simply checking whether or not if there is any data on that field?

Assuming your input has been validated so that it has to be either an exact match or a completely different number (i.e., (202) 123-4567, 202-123-4567, and 202.123.4567 are all the same real phone number)

In your IF EXISTS statement, add a WHERE [data].[phone] = [input].[phone]

When the expression comes true, how do I make it enter only that last row on the output table instead of entering all the pre-existing rows?

This is probably because you're pulling all the records, instead of just the one that matches the phone number.

john.knapp 25 Posting Whiz in Training

That is by design.
Cross-frame scripting is a vulnerability.

The design is to keep skimmers from hosting a bank's web page in an iframe and grabbing the user's personal data.

john.knapp 25 Posting Whiz in Training

Truncate table does just that - there are no empty rows after running that command.
What you are probably seeing is whatever SQL has for the default value on that column.

This is more of a SQL question, rather than VB specific

john.knapp 25 Posting Whiz in Training

Try this mod to your code

        ' clear the imagelist so we don't have extras
        ImageList1.Images.Clear()
        ' you need this next line to keep the ListView from flickering!
        ListView1.BeginUpdate()

        Dim di As New IO.DirectoryInfo(LocationA.Text)

        For Each fi As IO.FileInfo In di.GetFiles("*")
            ' provide a default icon in case we can't extract one
            Dim icons As Icon = SystemIcons.WinLogo
            ' set that default as the new listitem's icon
            Dim li As New ListViewItem(fi.Name, 1)
            ' check ImageList to see if we have an icon for this file type
            If Not (ImageList1.Images.ContainsKey(fi.Extension)) Then
                ' we don't, let's try to get one
                icons = System.Drawing.Icon.ExtractAssociatedIcon(fi.FullName)
                ImageList1.Images.Add(fi.Extension, icons)
            End If
            icons = Icon.ExtractAssociatedIcon(fi.FullName)
            ImageList1.Images.Add(icons)
            ListView1.Items.Add(fi.Name, fi.Extension)
        Next

        ' all done, redraw the listview
        ListView1.EndUpdate()
john.knapp 25 Posting Whiz in Training

You need to set the ImageIndex or ImageKey property for each item.
See How to: Display Icons for the Windows Forms ListView Control, and How to: Extract the Icon Associated with a File in Windows Forms for example code to add the ImageIndex or ImageKey and associate it with the file. FYI, ImageIndex and ImageKey are mutually exclusive.

john.knapp 25 Posting Whiz in Training

I still think you need to scrap everything you have and start over.
I don't believe you really understand what a class is, and that first one I posted was not a very good representation of a real class.

See below for a simple class for writing to a web page - I say "writing to a web page" because one of the documents methods calls the System.Web.HTTPContext.Current.Response.Write method, which is specific to ASP.Net.

Friend Class myHelloWorldClass

    'Private member variable accessible only
    'to the class
    Private m_sGreeting As String

    'Accessor method, controlled aliased
    'READ/WRITE access to your class variable
    Public Property Message() As String
        Get
            Return m_sGreeting
        End Get
        Set(ByVal sMsg As String)
            m_sGreeting = sMsg
        End Set
    End Property

    'The constructor, initialization for
    'your object
    Protected Friend Sub New()
        m_sGreeting = "Hello world!"
    End Sub

    'over loaded constructor
    Protected Friend Sub New(ByVal sMsg As String)
        Me.New()
        m_sGreeting = sMsg
    End Sub

    'Public class method, something this
    'class can do for you.
    Protected Friend Sub Greet()
        HttpContext.Current.Response.Write(m_sGreeting)
    End Sub

    'Clean up
    Protected Overrides Sub Finalize()

    End Sub

End Class
john.knapp 25 Posting Whiz in Training

Trusted Connection uses Windows Authentication, i.e., your Windows UserID & password.
You're then passing a SQL Authentication UserID & password... (Source: SQLConfigDataSource attributes here on MSDN)

BTW, you should never use "sa", that user has full control of the SQL Server instance.

john.knapp 25 Posting Whiz in Training

Just simply write a code with the help of which i change the connection string in app.config and then save.

I don't know what you mean by that, your english needs some extra translation. As it is written, my interpretation is that you want me to "just simply write <you> some code to change your connection string and save it.... Hopefully that is not really what you're trying to say.

I have a problem with "connectionstring.udl" what it is?

Connectionstring.udl is an empty plain text file. The .UDL extension causes Windows to open it with the Data Link Properties editor. To add it to your project would require too much work on my part - you should probably scrap that code and use your own.

when my project start it show Splash screen after that it show Connection Form in which i enter Database Name , server name, user name, password etc . Now after that i confuse that how i pass these value to connection string. and second thing when i set the connection string after that it not show Connection Form at Run Time when i ReOpen the Project..

Post the form name and the code for that form

john.knapp 25 Posting Whiz in Training

At the very top of "checklist.ascx" you have this directive

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Checklist.ascx.vb" Inherits="Flow. Checklist" %>

According to that line, Class Checklist is in Namespace Flow.
None of your other source files have the Namespace Flow directive.

In your solution, go to "Class View", expand the view on each object once, and take a screenshot. Crop, save as jpeg, and upload that screenshot

john.knapp 25 Posting Whiz in Training

Not sure what you have for controls to access your data (DataAdapter, TableAdapter, etc.)
But those control types usually have a RefreshSchema() method at the same level as Fill() - that should be somewhat close to the runtime equivilant of the designer operation previously linked.

john.knapp 25 Posting Whiz in Training

Best practice is to validate controls client-side and server-side.
Like pgmer said, client-side valiation is usually done with javascript, although it can be done with vbscript if that is your preference.

Regarding this statement:

actualy i need to write the code in vb.net and its nothing to do in asp.ner...its just a design only but all the coding i did in vb.net...

It has everything to do with ASP.Net. The ASP.Net object model governs how the controls are instantiated, accessed, loaded, etc.

For example, just copying and pasting your code doesn't work for me. See attached screenshot

john.knapp 25 Posting Whiz in Training

Here is a link to the walk-through at MSDN.

Google: msdn visual studio 2012 database project

john.knapp 25 Posting Whiz in Training

Post source code for "Checklist.ascx.vb".
Checklist.ascx is also "hosted" by a WebForm page, isn't it? Post that page and any code behind also.

john.knapp 25 Posting Whiz in Training

See if [this](http://stackoverflow.com/a/10597775"How to update the Dataset to reflect an added column in the data source without deleting the adapter?") works for you.

john.knapp 25 Posting Whiz in Training

HTML markup error on line 83 <<td> should be <td>

john.knapp 25 Posting Whiz in Training

@Swathys

Web Forms and Windows Forms have two completely different object models, and I have been coding for Windows Forms this entire time.

We need to start over, from scratch

john.knapp 25 Posting Whiz in Training

<asp:CheckBox runat="server" ID="checkbox1" Width="100px"></asp:CheckBox>

oh... my... gosh...

Protected Sub Page_Load

I should have noticed this and asked... <face palm>

john.knapp 25 Posting Whiz in Training

You can't add Radio Buttons to that existing method, to start with - you only have checkboxes in the array - which is also named CheckBoxArray, if you add other controls it only adds confusion.

john.knapp 25 Posting Whiz in Training
Have you ever tried using the String.Compare method for a case-insensitive string comparison?

The documentation on MSDN for the overloaded method:

'Declaration
Public Shared Function Compare ( _
    strA As String, _
    strB As String, _
    ignoreCase As Boolean _
) As Integer

states
Compares two specified String objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order.

At first glance, this looks like exactly what we want, doesn't it?

There's a catch... look at the documentation again, especially the last phrase
and returns an integer that indicates their relative position in the sort order

The integer value returned is 0 if the strings are equal, if you try to use this comparison in an If statement the return value is False.

For example:
dim stringA as String = "lowercase", stringB as String = "Lowercase"
String.Compare(stringA, stringB, True)
returns 0, which is a Boolean False.

There is a solution! String.Equals to the rescue!

stringA.Equals(stringB, StringComparison.OrdinalIgnoreCase)
returns True - As an added benefit, this is already a Boolean value!

There are lessons to be learned here:

  • Always, always, always, read the documentation! (ReadTheFineManual)
  • When you think you understand what it says, go read it again, write some example code and step through that code
  • When your code doesn't "behave" - go read the docs again...
john.knapp 25 Posting Whiz in Training

Hearty LOL!

I did write that without the IDE though :)

john.knapp 25 Posting Whiz in Training

and that's why he is the moderator

john.knapp 25 Posting Whiz in Training

Try this:

Private Sub btnSaveText_Click(sender As System.Object, e As System.EventArgs) Handles btnSaveText.Click
    ' assuming the form is the parent container of the textboxes
    ' otherwise use me.<container>.controls
    For Each ctrl As control In me.controls
        If TypeOf ctrl Is Textbox Then
        ' alternative check for ctrl.Name here
            If (Not(ctrl.text is nothing)) Then
                SaveText(ctrl.Text.ToString)
            End If
        ' end ctrl.Name check
        End If
    Next
End Sub

Sub SaveText(stringIn as String)
    ' TODO: your code here to save text
    Throw New NotImplementedException
End Sub
john.knapp 25 Posting Whiz in Training

Think outside the box... some of my best real life solutions have been pretty ugly, but still working 10 years later - although with one or two features that were not part of the initial design requirements! :)

john.knapp 25 Posting Whiz in Training

Some thoughts:

  1. Windows Forms Controls have a built-in CausesValidation property that fires when you leave a control - this can be used to validate the user input, This event will not fire if the user never enters the control though, so if they skip that control completely, nothing happens. You should probably use this to validate the user input as the user interacts with the form & controls, and have your class check to see whether all of the required controls have actually had some input/interaction.
  2. The Windows Forms ErrorProvider (Toolbox, All Windows Forms) can provide a visual cue to the user when the control action is not correct. The documentation for the ErrorProvider Class is here on MSDN.
john.knapp 25 Posting Whiz in Training

Update - if you're going to have to validate all of the controls, you are better off using the System.Windows.Forms.Form.ControlCollection collection object. This will already have all of your controls... :)

Suggestion for your checkbox array:
When you harcode the names of the controls, you will break the code if you change the names...

Dim chkbox As CheckBox() = {checkbox1, checkbox2, ..., checkbox5, checkbox6, checkbox7}

It is better to add the controls at runtime like the following:

For each myControl in Me.Controls
    If (TypeOf(myControl) Is CheckBox) Then
        ' checkbox specific code
    ElseIf
        (TypeOf(myControl) Is TextBox) Then
        ' textbox specific code
    Else
        ' not a checkbox or textbox
        ' handle accordingly
    End If
Next

' if you have a lot of different types to check
' a Select Case block may be cleaner
' readability == maintainability
john.knapp 25 Posting Whiz in Training

There's a syntax error in one of the exception handlers.. :)
Apparently I did an "Undo" between last compile and packaging up the source.
You'll find it when you try to compile. It's in one the section that handles the update I believe, and instead of :

Try
... <code>
Catch sqlex as exception
    ' stuff
Catch ex as exception
    'other stuff
End try

I have two sqlex exceptions instead of a sqlex and an ex:

Try
... <code>
Catch sqlex as exception
    ' stuff
Catch sqlex as exception
    'other stuff
End try
john.knapp 25 Posting Whiz in Training

So, if you're checking controls other than just checkbox, you need to change your class definition. What do you have for a class definition right now? I will also post a sample class for you to look at.

john.knapp 25 Posting Whiz in Training

That code is much cleaner to read - you're getting there!

john.knapp 25 Posting Whiz in Training

SQLClient is your DataProvider. In your original post, you made two requests (sic)

1:

Now i need code for how i set the connection i.e when i execute the project .exe it show me a form in which there is Database name , Server name , User name and Password . And after clicking the OK button it pass these value to connection string and save there.

tinstaafl suggested:

One relatively simple way is put, Database name , Server name , User name and Password, variables in a module, and have your new form have a series of textboxes that the user can enter the information. A command button can contain code to validate the information and then pass the values to the global variables. It should be a relatively simple matter to build the connection string from there

Do you understand what he is suggesting here? This sounds like it would satisfy your first requirement.

2:

I need simply the code for passing these value to connection string and how save these value there.

You just take the values from those textboxes, dropdown lists, or whatever and build the connection string.

For this question:

second thing when i set the connection string after that it not show Connection Form at Run Time when i ReOpen the Project

Try this code in your Form_Load() event

Dim strFile As String = "ChangeConnectionString.udl"
Dim strUserDocFldr As String = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Dim newFullPath As String …
john.knapp 25 Posting Whiz in Training

I think tinstaafl is on to something. What is the datatype for the CompanyID column in the Access database? Usually ID fields are auto-number integer values, but it looks like your SELECT query uses a text value in the WHERE clause (Line 9)
where CompanyID='" & txtnum.Text & "'"

john.knapp 25 Posting Whiz in Training

Try this discussion, see if any of the suggestions help you.

john.knapp 25 Posting Whiz in Training

which method are you using

john.knapp 25 Posting Whiz in Training

I posted the updated query in the other thread. Please close this thread, as I am still watching the other.

john.knapp 25 Posting Whiz in Training

There were at least 3 different methods suggested in this thread, which one are you having a problem with?

john.knapp 25 Posting Whiz in Training

Items have multiple entries in [Transaction Details]. That is throwing off the totals. Especially the Ttype = NULL rows. You might want to rethink your database design - especially if you can't query from it... :)

Try this and see if it works for you.

SELECT Description.Dgroup AS Description,
        COUNT(Item.IID) As TotalCount,
        [Under Repair]
FROM [Description] JOIN [Item]
    ON Description.DeID = Item.DeID
    JOIN (SELECT Description.Dgroup AS Description, 
                    SUM(CASE WHEN 
                        [Transaction Details].Ttype = 'Repair' 
                        THEN 1 ELSE 0 END) AS 'Under Repair'
            FROM [Transaction Details]
                JOIN [Item] ON [Transaction Details].[IID] = [Item].[IID]
                JOIN [Description] ON Description.DeID = Item.DeID
            GROUP BY DGroup) AS tmp
    ON Description.Dgroup = tmp.Description
WHERE [Under Repair] IS Not Null
GROUP BY DGroup, [Under Repair]
john.knapp 25 Posting Whiz in Training

IMHO, yes

john.knapp 25 Posting Whiz in Training

No problem. The query he gave you works, I checked it as soon as it was posted.

john.knapp 25 Posting Whiz in Training

Here's some source code at MSDN for the Data Connection Dialog that was
?packaged/affiliated/an add-in? for Visual Studio 2005. Alternatively, there's this project at CodeProject.com.

john.knapp 25 Posting Whiz in Training

Mine are still here...

john.knapp 25 Posting Whiz in Training

You need to code the statements for the DataAdapter's Update, Insert, Delete, and Search methods. You can get the statements themselves by using the OleDb.OleDbCommandBuilder to generate your statements, and then all you need to do is add the parameters.

da = New OleDb.OleDbDataAdapter(sql, con)
Dim cb As New OleDb.OleDbCommandBuilder(da)
da.InsertCommand = cb.GetInsertCommand
da.UpdateCommand = cb.GetUpdateCommand
da.DeleteCommand = cb.GetDeleteCommand
' haven't figured out parameters yet
' but they should probably go here
' then you would set their values per
' the respective textbox
da.Fill(ds, "stafftable")

Try this link for example code - I'll "fix" your Insert, but then you're on your own... :)

ps. I don't understand why the teachers couldn't see this issue... granted, it did take me some hardcore "googling" to figure it out

john.knapp 25 Posting Whiz in Training

Imports System.Data.SqlTypes made no difference, but in debugging I could see the Value property, which was not an available property in Intellisense. It turns out that SqlValue.Value is a late binding property.

I can only use If(CBool(retval.SqlValue.Value)) ... (and I still have to use CBool() because of my compiler settings) if I disable my late binding warning in Project Properties -> Warning Configurations -> Late binding; call could fail at run time.

I run Option Strict though, so I guess I can live with using the retval.Value object (and explicit type casting!) instead :)

Thanks for the help.

john.knapp 25 Posting Whiz in Training

You're missing some functionality.

  1. The dataset is not bound to an actual table in the database, it just retrieves the data
  2. The INSERT INTO command is being called even when it should be an UPDATE statement
  3. Item Three

How did you create this project and add the datasource, did you follow a tutorial, textbook, or ?

Can you zip and email the project to me? Email in PM

john.knapp 25 Posting Whiz in Training

Did you set the datasource in Visual Studio? When I recreated the project, I added the datasource and the designer created datatables, commands, etc. - do you have anything corresponding to that?

john.knapp 25 Posting Whiz in Training

Ok, I've managed to recreate that error now. I don't believe you have an INSERT or UPDATE statement in your DataAdapter (looking now) - see this thread for details on a similiar situation.