Results 1 to 10 of 10

Thread: [RESOLVED] Argument 'Prompt' cannot be converted to type 'String'.

  1. #1

    Thread Starter
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033

    Resolved [RESOLVED] Argument 'Prompt' cannot be converted to type 'String'.

    Im getting this exception when trying to create a database using an sql script...

    sql script:
    Code:
    IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'DBTest2')
    DROP DATABASE [DBTest2]
    
    CREATE DATABASE [DBTest2]  
    
    exec sp_dboption N'DBTest2', N'autoclose', N'true'
    
    
    exec sp_dboption N'DBTest2', N'bulkcopy', N'false'
    
    
    exec sp_dboption N'DBTest2', N'trunc. log', N'true'
    
    
    exec sp_dboption N'DBTest2', N'torn page detection', N'true'
    
    
    exec sp_dboption N'DBTest2', N'read only', N'false'
    
    
    exec sp_dboption N'DBTest2', N'dbo use', N'false'
    
    
    exec sp_dboption N'DBTest2', N'single', N'false'
    
    
    exec sp_dboption N'DBTest2', N'autoshrink', N'true'
    
    
    exec sp_dboption N'DBTest2', N'ANSI null default', N'false'
    
    
    exec sp_dboption N'DBTest2', N'recursive triggers', N'false'
    
    
    exec sp_dboption N'DBTest2', N'ANSI nulls', N'false'
    
    
    exec sp_dboption N'DBTest2', N'concat null yields null', N'false'
    
    
    exec sp_dboption N'DBTest2', N'cursor close on commit', N'false'
    
    
    exec sp_dboption N'DBTest2', N'default to local cursor', N'false'
    
    
    exec sp_dboption N'DBTest2', N'quoted identifier', N'false'
    
    
    exec sp_dboption N'DBTest2', N'ANSI warnings', N'false'
    
    
    exec sp_dboption N'DBTest2', N'auto create statistics', N'true'
    
    
    exec sp_dboption N'DBTest2', N'auto update statistics', N'true'
    
    
    use [DBTest2]
    
    
    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_HRM_AreaTematica_HRM_AreaEducForm]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
    ALTER TABLE [dbo].[HRM_AreaTematica] DROP CONSTRAINT FK_HRM_AreaTematica_HRM_AreaEducForm
    
    
    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_HRM_AreaEducForm_HRM_AreaEstudo]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
    ALTER TABLE [dbo].[HRM_AreaEducForm] DROP CONSTRAINT FK_HRM_AreaEducForm_HRM_AreaEstudo
    
    
    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[HRM_Apetrechamento]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[HRM_Apetrechamento]
    
    
    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[HRM_AreaEducForm]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[HRM_AreaEducForm]
    
    
    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[HRM_AreaEstudo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[HRM_AreaEstudo]
    
    
    CREATE TABLE [dbo].[HRM_Apetrechamento] (
    	[id] [int] IDENTITY (1, 1) NOT NULL ,
    	[ref] [varchar] (50) COLLATE Latin1_General_CI_AS NOT NULL ,
    	[ref_id] [int] NOT NULL ,
    	[designacao] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
    	[quantidade] [int] NULL ,
    	[observacoes] [varchar] (250) COLLATE Latin1_General_CI_AS NULL 
    ) ON [PRIMARY]
    
    
    CREATE TABLE [dbo].[HRM_AreaEducForm] (
    	[id] [int] IDENTITY (1, 1) NOT NULL ,
    	[codigo] [varchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    	[designacao] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    	[areaestudo_id] [int] NOT NULL 
    ) ON [PRIMARY]
    
    
    CREATE TABLE [dbo].[HRM_AreaEstudo] (
    	[id] [int] IDENTITY (1, 1) NOT NULL ,
    	[codigo] [varchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    	[designacao] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    	[grgrupo_id] [int] NOT NULL 
    ) ON [PRIMARY]
    
    
    ALTER TABLE [dbo].[HRM_Apetrechamento] WITH NOCHECK ADD 
    	CONSTRAINT [PK_HRM_Apetrechamento] PRIMARY KEY  CLUSTERED 
    	(
    		[id]
    	)  ON [PRIMARY] 
    
    
    ALTER TABLE [dbo].[HRM_AreaEducForm] WITH NOCHECK ADD 
    	CONSTRAINT [PK_HRM_AreaEducForm] PRIMARY KEY  CLUSTERED 
    	(
    		[id]
    	)  ON [PRIMARY] 
    
    
    ALTER TABLE [dbo].[HRM_AreaEstudo] WITH NOCHECK ADD 
    	CONSTRAINT [PK_HRM_AreaEstudo] PRIMARY KEY  CLUSTERED 
    	(
    		[id]
    	)  ON [PRIMARY] 
    
    
    ALTER TABLE [dbo].[HRM_AreaEducForm] ADD 
    	CONSTRAINT [FK_HRM_AreaEducForm_HRM_AreaEstudo] FOREIGN KEY 
    	(
    		[areaestudo_id]
    	) REFERENCES [dbo].[HRM_AreaEstudo] (
    		[id]
    	)
    
    
    ALTER TABLE [dbo].[HRM_AreaEstudo] ADD 
    	CONSTRAINT [FK_HRM_AreaEstudo_HRM_GrGrupos] FOREIGN KEY 
    	(
    		[grgrupo_id]
    	) REFERENCES [dbo].[HRM_GrGrupos] (
    		[id]
    	)
    vb code:
    Code:
        Private Sub CreateDB(ByVal value As String)
    
            Dim objCommand As New SqlClient.SqlCommand()
    
            With objCommand
                .Connection = _objDataFactory.Connection
                .CommandText = value
                .CommandType = CommandType.Text
    
                Try
                    .ExecuteNonQuery()
                Catch ex As Exception
                    MsgBox(ex)
                    Exit Sub
                End Try
            End With
    
            MsgBox("Completed with no errors.")
    
        End Sub
    Any clue?
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  2. #2
    Fanatic Member Lasering's Avatar
    Join Date
    May 2006
    Location
    Lisboa
    Posts
    559

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    Try this:
    Tenta isto:
    vb Code:
    1. Catch ex As Exception
    2.     MsgBox(ex.Message)
    3.     Exit Sub
    4. End Try
    Controls: XPCC|Quantum
    Windows API'sLINQ to XML SamplesRegex Tutorial

    Albert Einstein:
    "Imagination is more important than knowledge."
    "Everything should be made as simple as possible, but not simpler."
    "Great spirits have often encountered violent opposition from weak minds."

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    Where does it fail? What line.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  4. #4

    Thread Starter
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    Quote Originally Posted by Lasering
    Try this:
    Tenta isto:
    vb Code:
    1. Catch ex As Exception
    2.     MsgBox(ex.Message)
    3.     Exit Sub
    4. End Try

    this is the exception details:

    Code:
    System.ArgumentException was unhandled
      Message="Argument 'Prompt' cannot be converted to type 'String'."
      Source="Microsoft.VisualBasic"
      StackTrace:
           at Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title)
           at HRM.Admin.CreateTables(String value) in F:\Workspace\src\HRM\Forms\Global\Admin.vb:line 63
           at HRM.Admin.cmdCreateDB_Click(Object sender, EventArgs e) in F:\Workspace\src\HRM\Forms\Global\Admin.vb:line 45
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ButtonBase.WndProc(Message& m)
           at System.Windows.Forms.Button.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
           at HRM.Main.mnuAdministrador_Click(Object sender, EventArgs e) in F:\Workspace\src\HRM\Forms\Global\Main.vb:line 1286
           at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
           at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
           at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
           at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
           at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
           at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
           at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
           at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at System.Windows.Forms.ToolStrip.WndProc(Message& m)
           at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(ApplicationContext context)
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
           at HRM.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
           at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  5. #5

    Thread Starter
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    Quote Originally Posted by GaryMazzone
    Where does it fail? What line.
    dont know... perhaps some character in the script...
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  6. #6
    Fanatic Member Lasering's Avatar
    Join Date
    May 2006
    Location
    Lisboa
    Posts
    559

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    As it says
    at Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title)
    try to delete the line Msgbox(ex.Message), if still gives an error, then i cant help, if it gives no error, then u can try Msgbox(ex.Message.ToString).
    Controls: XPCC|Quantum
    Windows API'sLINQ to XML SamplesRegex Tutorial

    Albert Einstein:
    "Imagination is more important than knowledge."
    "Everything should be made as simple as possible, but not simpler."
    "Great spirits have often encountered violent opposition from weak minds."

  7. #7
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    Can you run each part of the script in SQL Server managment Studio on its own? Run each line not the script as a whole and see where it errors
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    Aww man..... dude...
    1) Use MEssageBox.Show... not msgbox...
    2) change it to ex.ToString to get it to display....

    Lastly, expand the catch like so:

    Code:
    Catch sqlEx as SQLException
      Messagebox.Show sqlEx.ToStirng
    Catch ex as Exception
      MessageBox.Show ex.ToString
    You'll get more meaningful messages that way.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  9. #9

    Thread Starter
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    Quote Originally Posted by techgnome
    Aww man..... dude...
    1) Use MEssageBox.Show... not msgbox...
    2) change it to ex.ToString to get it to display....

    Lastly, expand the catch like so:

    Code:
    Catch sqlEx as SQLException
      Messagebox.Show sqlEx.ToStirng
    Catch ex as Exception
      MessageBox.Show ex.ToString
    You'll get more meaningful messages that way.

    -tg
    "MEssageBox.Show" thats not the point... this is just a testing code...

    i already figure out... i removed the GO statements... thats why im getting this errors... to solve this i must parse the script in statements and execute one at time...

    thx...
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  10. #10

    Thread Starter
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033

    Re: Argument 'Prompt' cannot be converted to type 'String'.

    Problem solved...

    I managed to parse in different statments (split the query using the GO command) and execute one at each time...

    working great...
    http://blog.humanhrm.com/?p=55
    (sorry, its in portuguese...)
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width