Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Tinyint via odbc vb.net

Posted on 2011-02-17
7
Medium Priority
?
571 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
Industry Leaders: 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

Industry Leaders: 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!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 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