Solved

Tinyint via odbc vb.net

Posted on 2011-02-17
7
548 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Allow User To Arrange Columns At Datagridview 3 26
Need a starter for ETL protocol? 4 57
VB.NET (2008) - Refactoring Question 2 21
Expression Evaluater 3 26
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

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