Solved

Tinyint via odbc vb.net

Posted on 2011-02-17
7
551 Views
Last Modified: 2012-06-21
Am trying to write value in a db where column type is byte which is odbc type of tinyint.i tried all methods i know but it wont write it.
here is the code that i have so if anyone would be kind to solve me this problem i would appreciate
tryed adding parameters but i don't know how to add them proper
if someone more experienced can change my modify my code to write this tinyint would be great
am using vb.net with vs2010.and am using odbc drivers
Dim oCon As Odbc.OdbcConnection
        Dim cmd As New OdbcCommand
        Dim oPath As String
        oPath = Application.StartupPath
Dim format As Integer = txtvrijednosttest.Text
            Dim kolona As String = "USER"
            oCon = New Odbc.OdbcConnection
            oCon.ConnectionString = "Driver={Topspeed ODBC Driver};Dbq=" & oPath & "\Formati.tps\!;Datefield=MyDateField;|MyOtherDateField;TimeField=MyTimeField|MyOtherTimeField;"
            cmd.CommandText = "INSERT INTO UNNAMED (" & kolona & ") VALUES (format)"
            cmd.Connection = oCon
            oCon.Open()
            cmd.ExecuteNonQuery()
            cmd.Dispose()
            oCon.Close()
            oCon.Dispose()

Open in new window

0
Comment
Question by:LaserAdmin
  • 4
  • 2
7 Comments
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 34914049
In your string
cmd.CommandText = "INSERT INTO UNNAMED (" & kolona & ") VALUES (format)"
You must write
cmd.CommandText = "INSERT INTO UNNAMED (" & kolona & ") VALUES (" & format & ")"

Try this. Hope that helps.

0
 

Author Comment

by:LaserAdmin
ID: 34914071
tryed but same

need to tell odbc somehow that its tinyint type need that parameter thing
0
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 34914081
Do you get some exception, some error message?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 34914112
try boolean value

  Dim blval As Boolean
        blval = True
 cmd.CommandText = "INSERT INTO UNNAMED (" & kolona & ") VALUES (" blval ")"

or Int16
  Dim blval As Int16
        blval = 1
 cmd.CommandText = "INSERT INTO UNNAMED (" & kolona & ") VALUES (" blval ")"
0
 

Author Comment

by:LaserAdmin
ID: 34914116
lexical element not found <identifier>
odbc driver is topspeed odbc since amsaving to tps db but their odbc is same as standard odbc so strictly stating to it that its tinyint would should work i think
0
 

Accepted Solution

by:
LaserAdmin earned 0 total points
ID: 34914665
Solved myself
clarion need $ along with column name to know that its byte type
0
 

Author Closing Comment

by:LaserAdmin
ID: 34949643
working on solving this for like 1month and nobody manged to answer my question and after a while i figured myself so i chose my own answer as solution
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question