Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. 2 problems

2 problems

Scheduled Pinned Locked Moved ASP.NET
questioncsharpdatabasesql-serversysadmin
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    x trate
    wrote on last edited by
    #1

    Hi! I have a two problems: 1)How do i use messagebox in asp? (in C# project is MessageBox.Show("..."), but this doesn't work in asp). 2) In Microsoft Access is a field "autoincrement". Is there something like that in Mocrosoft sql server(that automatically increments that field)?

    C J 2 Replies Last reply
    0
    • X x trate

      Hi! I have a two problems: 1)How do i use messagebox in asp? (in C# project is MessageBox.Show("..."), but this doesn't work in asp). 2) In Microsoft Access is a field "autoincrement". Is there something like that in Mocrosoft sql server(that automatically increments that field)?

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      x-trate wrote: 1)How do i use messagebox in asp? (in C# project is MessageBox.Show("..."), but this doesn't work in asp). Actually the C# won't work that way. If you do that in ASP.NET the message box will pop-up on the server and most likely hang it until someone clicks the button. You do NOT want to do that! You can use javascript to pop open a message box on the client.alert[^] x-trate wrote: 2) In Microsoft Access is a field "autoincrement". Is there something like that in Mocrosoft sql server(that automatically increments that field)? You can create an identity column in SQL Server like this:

      CREATE TABLE myTable(ID int IDENTITY(1,1) NOT NULL, ...)

      Does this help?


      My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

      X 1 Reply Last reply
      0
      • C Colin Angus Mackay

        x-trate wrote: 1)How do i use messagebox in asp? (in C# project is MessageBox.Show("..."), but this doesn't work in asp). Actually the C# won't work that way. If you do that in ASP.NET the message box will pop-up on the server and most likely hang it until someone clicks the button. You do NOT want to do that! You can use javascript to pop open a message box on the client.alert[^] x-trate wrote: 2) In Microsoft Access is a field "autoincrement". Is there something like that in Mocrosoft sql server(that automatically increments that field)? You can create an identity column in SQL Server like this:

        CREATE TABLE myTable(ID int IDENTITY(1,1) NOT NULL, ...)

        Does this help?


        My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

        X Offline
        X Offline
        x trate
        wrote on last edited by
        #3

        Thanks! It helps a little! But... If i use an identity column like you just said then this will increment automatically when i add something else?(so if i use an insert command, i have to put in that command also this identity column or not)? And about the message box:for example, when i push a submit button, if a textbox is not filled in, then a messagebox should appear. I saw that there are some validation controls for this, but in order to do like i said i can use only Javascript? Thanks!

        C C A 3 Replies Last reply
        0
        • X x trate

          Thanks! It helps a little! But... If i use an identity column like you just said then this will increment automatically when i add something else?(so if i use an insert command, i have to put in that command also this identity column or not)? And about the message box:for example, when i push a submit button, if a textbox is not filled in, then a messagebox should appear. I saw that there are some validation controls for this, but in order to do like i said i can use only Javascript? Thanks!

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          x-trate wrote: If i use an identity column like you just said then this will increment automatically when i add something else( Yes. The numbers in brackets are the seed value and the increment value - but I've always kept them as (1,1) x-trate wrote: so if i use an insert command, i have to put in that command also this identity column or not? No, the column value will be created automatically. If you attempt to assign it yourself you will get an error. x-trate wrote: in order to do like i said i can use only Javascript? Yes, because the message box has to appear on the client. It won't do any good with the message box on the server.


          My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

          1 Reply Last reply
          0
          • X x trate

            Thanks! It helps a little! But... If i use an identity column like you just said then this will increment automatically when i add something else?(so if i use an insert command, i have to put in that command also this identity column or not)? And about the message box:for example, when i push a submit button, if a textbox is not filled in, then a messagebox should appear. I saw that there are some validation controls for this, but in order to do like i said i can use only Javascript? Thanks!

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            x-trate wrote: I saw that there are some validation controls for this, but in order to do like i said i can use only Javascript? No, the validation controls generate javascript for you. Either way, it needs to end up as Javascript, and run on the server ( MessageBox.Show will stop your server dead, as it will show on the server ), but you don't need to write any jscript to use validators, they know how to do that for you. Christian Graus - Microsoft MVP - C++

            1 Reply Last reply
            0
            • X x trate

              Hi! I have a two problems: 1)How do i use messagebox in asp? (in C# project is MessageBox.Show("..."), but this doesn't work in asp). 2) In Microsoft Access is a field "autoincrement". Is there something like that in Mocrosoft sql server(that automatically increments that field)?

              J Offline
              J Offline
              jitendrapatel
              wrote on last edited by
              #6

              Hi solutions for ur problems are as below. 1. there is no Messagebox in asp. If u want to show message as messagebox u have to use JavaSciptss alert() function. 2. In microsoft access there is autoincrement field. If u want to use something like that in SQL Server there is Identity field and Increment field. Use that to use increment number automatically by number which is given in the Increment field. If u problem will be solve reply me. Bye.. J. A. Patel

              A 1 Reply Last reply
              0
              • X x trate

                Thanks! It helps a little! But... If i use an identity column like you just said then this will increment automatically when i add something else?(so if i use an insert command, i have to put in that command also this identity column or not)? And about the message box:for example, when i push a submit button, if a textbox is not filled in, then a messagebox should appear. I saw that there are some validation controls for this, but in order to do like i said i can use only Javascript? Thanks!

                A Offline
                A Offline
                Alexandru Savescu
                wrote on last edited by
                #7

                You don't have to put the identitiy in the insert command, the sql server will automatically generate it. However, if you want to use that ID then when you create the insert commmand check the "refresh the dataset option", it will add a new select command and will update the dataset. Regards, Alexandru Savescu

                1 Reply Last reply
                0
                • J jitendrapatel

                  Hi solutions for ur problems are as below. 1. there is no Messagebox in asp. If u want to show message as messagebox u have to use JavaSciptss alert() function. 2. In microsoft access there is autoincrement field. If u want to use something like that in SQL Server there is Identity field and Increment field. Use that to use increment number automatically by number which is given in the Increment field. If u problem will be solve reply me. Bye.. J. A. Patel

                  A Offline
                  A Offline
                  Anonymous
                  wrote on last edited by
                  #8

                  Yes, it helps a lot. This Identity field makes my work easier. Thanks!

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups