?
Solved

Tinyint via odbc vb.net

Posted on 2011-02-17
7
Medium Priority
?
565 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 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