Application Development

  • Hi 

    I had already started another thread, but after a long meeting here at work, I have been given more specific instruction about what they need: I need to build an application, but it's more of a study project, they don't really expect me to succeed, and that's why I would like to succeed.

    It would look something like this:

    After a login, you are directed to your personal page where you have 3 options:

    a- fill out a new form(quote) to submit

    b- continue filling out a previously started form

    c- review forms that you have already submitted

    The form should have a SUBMIT and a SAVE button.

    Behind the form I have a SQL server database running on Windows 2003 server.

    After the form is filled two emails need to go out, one to me and one to the person that has filled the form, with the form attached and ready to be printed.

    That's it! Easy, right?

    Now, what I am asking here is for directions and some help while I learn all that is involved, I am a web developer but not a dba, but I am studying SQL server and SQL statements...

    Anybody want in? 

    Ok, I guess the first step is to figure out how to do this. In which order?

    Thank you in any case just for reading all of this,

    elise

  • Seems very simple. You'd have one or two tables containing the form info. Then you need one proc to insert the new data, one more to update the data and one last to select the forms data to be able to make changes. As far as e-mailing I've never done that with sql server so I'll let someone else answer that one. However I can tell you that it's not hard to do . The rest is simply to control the flow of the program, something that you should already be able to do.

  • I'm glad to hear that it's simple...

    but I need a bit more guided help:

    I will start by creating the form(s) and the tables in the database.

    The form will put information on the database.

    Then? Where do I write these procedures and what do they look like?

    thank you.

  • You need to buy a book for this. I would strongly suggest that you follow a basic sql server course to get you started. You have too much to learn for me to show you in only a few minutes.

    I may suggest you visit this site to get you started :

    http://www.w3schools.com/sql/default.asp

  • Remi,

    c'mon, first you said it was very simple...

    well, I am studying SQL (and I will print out the site you gave me, thanks)... which statements should I look at? I guess INSERT is good when they submit a form. How do I save information to be retrieved later? Which statement would do that?

    and no, I never thought I was going to do this in few minutes, but I have to start somewhere, and the forums have always helped me when I was stuck.

    thanks again,

  • Let me rephrase. It's very simple for a diplomed programmer .

    Anyways, here's an exemple of an insert/update/delete/select procs that you will need for this project.

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_NULLS ON

    GO

    ----------------------------------------------------------------------------

    -- Delete a single record from ObjSQL

    ----------------------------------------------------------------------------

    CREATE PROC [DBO].[ObjSQL_Delete]

    @PkObjSQL int

    AS

    DELETEObjSQL

    WHERE PkObjSQL = @PkObjSQL

    GO

    SET QUOTED_IDENTIFIER OFF

    GO

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_NULLS ON

    GO

    ----------------------------------------------------------------------------

    -- Insert a single record into ObjSQL

    ----------------------------------------------------------------------------

    CREATE PROC [DBO].[ObjSQL_Insert]

    @xtype varchar(3),

    @id int,

    @name varchar(128),

    @FkParent int,

    @FkDB int,

    @Colid int = NULL,

    @keyno smallint = NULL,

    @RefDate datetime = NULL,

    @Deleted bit = NULL,

    @IsPK bit = NULL,

    @Owner varchar(256),

    @indid smallint = NULL,

    @Length smallint = NULL,

    @isOutParam bit = NULL,

    @ColPrecision smallint = NULL,

    @VarTypeName varchar(16) = NULL,

    @DefaultValue varchar(4000) = NULL,

    @FkParentOBJ int = NULL,

    @IgnoreObsolete bit = NULL

    AS

    INSERT ObjSQL(xtype, id, name, FkParent, FkDB, Colid, keyno, RefDate, Deleted, IsPK, Owner, indid, Length, isOutParam, ColPrecision, VarTypeName, DefaultValue, FkParentOBJ, IgnoreObsolete)

    VALUES (@xtype, @id, @name, @FkParent, @FkDB, COALESCE(@Colid, 0), COALESCE(@keyno, 0), COALESCE(@RefDate, getdate()), COALESCE(@Deleted, 0), COALESCE(@IsPK, 0), @Owner, COALESCE(@indid, 0), COALESCE(@Length, 0), COALESCE(@isOutParam, 0), COALESCE(@ColPrecision, 0), COALESCE(@VarTypeName, ''), @DefaultValue, @FkParentOBJ, COALESCE(@IgnoreObsolete, 0))

    RETURN SCOPE_IDENTITY()

    GO

    SET QUOTED_IDENTIFIER OFF

    GO

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_NULLS ON

    GO

    ----------------------------------------------------------------------------

    -- Select a single record from ObjSQL

    ----------------------------------------------------------------------------

    CREATE PROC [DBO].[ObjSQL_Select]

    @PkObjSQL int

    AS

    SELECTPkObjSQL,

    xtype,

    id,

    name,

    FkParent,

    FkDB,

    Colid,

    keyno,

    RefDate,

    Deleted,

    IsPK,

    Owner,

    indid,

    Length,

    isOutParam,

    ColPrecision,

    VarTypeName,

    DefaultValue,

    FkParentOBJ,

    IgnoreObsolete

    FROMObjSQL

    WHERE PkObjSQL = @PkObjSQL

    GO

    SET QUOTED_IDENTIFIER OFF

    GO

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_NULLS ON

    GO

    ----------------------------------------------------------------------------

    -- Update a single record in ObjSQL

    ----------------------------------------------------------------------------

    CREATE PROC [DBO].[ObjSQL_Update]

    @PkObjSQL int,

    @xtype varchar(3),

    @id int,

    @name varchar(128),

    @FkParent int,

    @FkDB int,

    @Colid int,

    @keyno smallint,

    @RefDate datetime,

    @Deleted bit,

    @IsPK bit,

    @Owner varchar(256),

    @indid smallint,

    @Length smallint,

    @isOutParam bit,

    @ColPrecision smallint,

    @VarTypeName varchar(16),

    @DefaultValue varchar(4000) = NULL,

    @FkParentOBJ int = NULL,

    @IgnoreObsolete bit

    AS

    UPDATEObjSQL

    SETxtype = @xtype,

    id = @id,

    name = @name,

    FkParent = @FkParent,

    FkDB = @FkDB,

    Colid = COALESCE(@Colid, 0),

    keyno = COALESCE(@keyno, 0),

    RefDate = COALESCE(@RefDate, getdate()),

    Deleted = COALESCE(@Deleted, 0),

    IsPK = COALESCE(@IsPK, 0),

    Owner = @Owner,

    indid = COALESCE(@indid, 0),

    Length = COALESCE(@Length, 0),

    isOutParam = COALESCE(@isOutParam, 0),

    ColPrecision = COALESCE(@ColPrecision, 0),

    VarTypeName = COALESCE(@VarTypeName, ''),

    DefaultValue = @DefaultValue,

    FkParentOBJ = @FkParentOBJ,

    IgnoreObsolete = COALESCE(@IgnoreObsolete, 0)

    WHERE PkObjSQL = @PkObjSQL

    GO

    SET QUOTED_IDENTIFIER OFF

    GO

    SET ANSI_NULLS ON

    GO

  • -- Let me rephrase. It's very simple for a diplomed programmer .

    But of course! That's so not me (yet).

    Thank you for the codes, I will look at them and post again if I have any questions.

    elise

     

  • For the email:

    You will want to send the email through your application using SMTP.  I would probably go this route.

    or

    If you can configure email on the sql server then:

    Lookup "xp_sendmail" in the Books on line.  You can send attachments this way.  Just add a section in the sproc that Remi gave you.  You could also do this through a trigger on the table, but in this case I wouldn't.

     

  • Hi Elise,

    There is a second way also. One which I follow and you do not need to know that much about SQL Server.

    Just use ADODB connections to connect to the database. You need to know only four statements of SQL.

    Insert, Delete, Update and Select.

    Regarding mail. - If you are using IIS for web server, you can use SMTP and in your web page use CDONTS to send mail.

    Do get back if you need further details.

    In development, I have found tha first thing which you will have to decide is what you want to do. Develop a web page having those functionalities through ASP programs or through lot of SQL scripts. Both have their advantages and pitfalls.

     

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply