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. General Programming
  3. Visual Basic
  4. Error

Error

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestioncsharp
2 Posts 2 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.
  • N Offline
    N Offline
    nilam11
    wrote on last edited by
    #1

    hi i have developed my application in vb.net2005 & inbuilt crystal report. i have taken one maskeditbox with 'shortdatetime' data type & in database - sql server2005 there is also datatype is 'datetime'.but after executing application following error occured - error - unable to cast object of type 'system.string' to type 'system.IFormatProvider' my namespaces are - imports system.data imports system.data.client sql_str = " insert into abc(mdate2,itemcode)(select mdate2,itemcode from xyz where mdate2 = " & " " & convert.date(me.maskedbox1.text) & " )" my stored date format is 'dd/MM/yyyy' with time 00:00:00. but i do not want this time.what i do ? plz. help me. i want only date in dd/MM/yyyy format without time and datatype 'datetime' using maskeditbox . how can i do calculation on date suggest me code with sample.

    Thanks bye

    C 1 Reply Last reply
    0
    • N nilam11

      hi i have developed my application in vb.net2005 & inbuilt crystal report. i have taken one maskeditbox with 'shortdatetime' data type & in database - sql server2005 there is also datatype is 'datetime'.but after executing application following error occured - error - unable to cast object of type 'system.string' to type 'system.IFormatProvider' my namespaces are - imports system.data imports system.data.client sql_str = " insert into abc(mdate2,itemcode)(select mdate2,itemcode from xyz where mdate2 = " & " " & convert.date(me.maskedbox1.text) & " )" my stored date format is 'dd/MM/yyyy' with time 00:00:00. but i do not want this time.what i do ? plz. help me. i want only date in dd/MM/yyyy format without time and datatype 'datetime' using maskeditbox . how can i do calculation on date suggest me code with sample.

      Thanks bye

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

      You know if you used parameterised queries you wouldn't have to worry about converting date formats and you would improve the security between your application and the database at the same time as you reduce the possibility of SQL Injection Attacks. Please read SQL Injection Attacks and Tips on How To Prevent Them[^]


      Upcoming FREE developer events: * Developer! Developer! Developer! 6 * Developer Day Scotland My website

      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