# csharp,c# kdblib.dll \[kdb+ 3.x\]

**URL:** https://forum.kx.com/t/csharp-c-kdblib-dll-kdb-3-x/8481
**Category:** Community Support
**Tags:** kdb-and-q
**Created:** [November 15, 2013, 3:39pm UTC](https://forum.kx.com/t/csharp-c-kdblib-dll-kdb-3-x/8481 "2013-11-15T15:39:00Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![reptile1](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@reptile1](https://forum.kx.com/u/reptile1)
#### Post date: [November 15, 2013, 3:39pm UTC](https://forum.kx.com/t/csharp-c-kdblib-dll-kdb-3-x/8481/1 "2013-11-15T15:39:00Z")

</div>

Hi,

I have VS2013 and looking .dll for kdb+ 3.x to add as refference if is posible (exist?), coz I lost in this all many .dll's (as cst.dll c.dll)

> **[Database – tables in the filesystem | Documentation for q and kdb+ - kdb+ and...](https://code.kx.com/wiki/Cookbook/InterfacingWithCSharp)**
>
> kdb+ is what happens when q tables are persisted to the filesystem

I sugesting some philosophy around libmysql.dll to cut this type questions in future.

Here is..  
&nbsp;

1. Exist folder but empty now

## /kx/kdb+/interfaces/csharp/example

[http://code.kx.com/wsvn/code/kx/kdb%2B/interfaces/csharp/?#aa2a97ba7ee3e6d29f1fcf83cb43d5711](http://code.kx.com/wsvn/code/kx/kdb%2B/interfaces/csharp/?#aa2a97ba7ee3e6d29f1fcf83cb43d5711)

1. Exist example but not working in my case (breaking)  
[http://code.kx.com/wsvn/code/kx/kdb%2B/c/c.cs](http://code.kx.com/wsvn/code/kx/kdb%2B/c/c.cs)

2. just looking simple proof that my kdb+ and c# app working for query "trade" as result

&nbsp;&nbsp;&nbsp; public class c : TcpClient  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static void Main(stringargs){  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string host = "localhost";  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int port = "5000";

//query  
string query ="trade";

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine("test-start");

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(result);//result like in console

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine("test-end");  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //-- Console.WriteLine("Press any key to continue . . . ");  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.ReadKey(true);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

---

<div class="post-metadata">

### Author: ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)
#### Post date: [November 15, 2013, 3:50pm UTC](https://forum.kx.com/t/csharp-c-kdblib-dll-kdb-3-x/8481/2 "2013-11-15T15:50:00Z")

</div>

you need only http://kx.com/q/c/c.cs

that does not depend on c.dll etc.

Can you be more specific about the error? “Breaking” is too wide a description for us to help.

thanks

---

<div class="post-metadata">

### Author: ![reptile1](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@reptile1](https://forum.kx.com/u/reptile1)
#### Post date: [November 15, 2013, 5:12pm UTC](https://forum.kx.com/t/csharp-c-kdblib-dll-kdb-3-x/8481/3 "2013-11-15T17:12:00Z")

</div>

&nbsp;&nbsp;&nbsp; public class c : TcpClient  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static void Main(stringargs){  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [//c.ReceiveTimeout=1000](https://c.ReceiveTimeout=1000);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c c=new c(“localhost”,5000);c.k(“.u.sub[`trade;`MSFT.O`IBM.N]");while(true){object r=c.k();O(n(at(r,2)));} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //c c=new c("localhost",5000); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //string result = c.k("trade"); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Console.WriteLine(result); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine("test-end"); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //-- Console.WriteLine("Press any key to continue . . . "); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.ReadKey(true); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //c.e=System.Text.Encoding.UTF8; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //O("Unicode "+c.k("`$"c"$0x52616e627920426ac3b6726b6c756e64204142”));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //objectx=new object[4];x[0]=t();x[1]=“xx”;x[2]=(double)93.5;x[3]=300;tm();for(int i=0;i\<1000;++i)c.k(“insert”,“trade”,x);tm();  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Flip r=td(c.k(“select sum price by sym from trade”));O("cols: "+n(r.x));O("rows: "+n(r.y[0]));  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c.Close();  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }

* * *

by restoring part of code

c c=new c(“localhost”,5000);c.k(“.u.sub[`trade;`MSFT.O`IBM.N]”);while(true){object r=c.k();O(n(at(r,2)));}  
Warning&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; Unreachable code detected&nbsp;&nbsp;&nbsp; \Visual Studio 2013\Projects\kx.com\kx\kx\Program.cs&nbsp;&nbsp;&nbsp; 34&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp; kx

if  
c.ReceiveTimeout=1000;  
Error&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; Cannot use local variable ‘c’ before it is declared&nbsp; \Visual Studio 2013\Projects\kx.com\kx\kx\Program.cs&nbsp;&nbsp;&nbsp; 29&nbsp;&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp; kx

if  
Flip r=td(c.k(“select sum price by sym from trade”));O("cols: "+n(r.x));O("rows: "+n(r.y[0]));  
Error&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; A local variable named ‘r’ cannot be declared in this scope because it would give a different meaning to ‘r’, which is already used in a ‘child’ scope to denote something else&nbsp;&nbsp;&nbsp; Visual Studio 2013\Projects\kx.com\kx\kx\Program.cs&nbsp;&nbsp;&nbsp; 40&nbsp;&nbsp;&nbsp; 14&nbsp;&nbsp;&nbsp; kx

–  
The clear working examples step by step can be very helpful. Looks csharp here is not popular.  
Q is enough complicated for me to meet rest of class to be sure what is source for all and specialy if no exist any comments.  
Some dll can popularise this kdb+ server but if we fighting in first steps then some patience can be destroyied before any work : )  
.. like in my case :D

Soo..&nbsp;  
I’ll glad for some basic examples (result in c# console like select in kdb). And if any .dll can be published with standard described functions then GREAT! : ]

---

<div class="post-metadata">

### Author: ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)
#### Post date: [November 15, 2013, 5:21pm UTC](https://forum.kx.com/t/csharp-c-kdblib-dll-kdb-3-x/8481/4 "2013-11-15T17:21:00Z")

</div>

the exception shown is reporting that the server does not have .u.sub defined.  
All the drivers (c#,java,..) are fairly simple [de]serializers, all following the same pattern.

You can serialize objects, send them to kdb+ for execution, and optionally receive a return value.

We’ll create some examples.

---

<div class="post-metadata">

### Author: ![reptile1](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@reptile1](https://forum.kx.com/u/reptile1)
#### Post date: [November 15, 2013, 9:24pm UTC](https://forum.kx.com/t/csharp-c-kdblib-dll-kdb-3-x/8481/5 "2013-11-15T21:24:00Z")

</div>

Thx, waiting for some links.

Is any chance to get updated adequate kdblib.dll for kdb3.1 and nexts ver from kx ? Similar to mysql lib? Or it’s to much for company?

Looks I made mistake to instal VS2013, coz exist many unexpected cases like bugs (colour for syntax in editor [often missed], and dot.dot adress sugestion) what doing disonanse for me and don’t have trust. I’m new with this all workspace.

W dniu pi?tek, 15 listopada 2013 18:21:29 UTC+1 u?ytkownik Charles Skelton napisa?:

> the exception shown is reporting that the server does not have .u.sub defined.  
> All the drivers (c#,java,..) are fairly simple [de]serializers, all following the same pattern.
> 
> You can serialize objects, send them to kdb+ for execution, and optionally receive a return value.
> 
> We’ll create some examples.

---

<div class="post-metadata">

### Author: ![reptile1](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@reptile1](https://forum.kx.com/u/reptile1)
#### Post date: [November 16, 2013, 6:55pm UTC](https://forum.kx.com/t/csharp-c-kdblib-dll-kdb-3-x/8481/6 "2013-11-16T18:55:00Z")

</div>

And examples exist. Thx again.

[http://code.kx.com/wiki/Cookbook/InterfacingWithCSharp#Examples](http://code.kx.com/wiki/Cookbook/InterfacingWithCSharp#Examples)

W dniu pi?tek, 15 listopada 2013 22:24:56 UTC+1 u?ytkownik reptile napisa?:

> Thx, waiting for some links.
> 
> Is any chance to get updated adequate kdblib.dll for kdb3.1 and nexts ver from kx ? Similar to mysql lib? Or it’s to much for company?
> 
> Looks I made mistake to instal VS2013, coz exist many unexpected cases like bugs (colour for syntax in editor [often missed], and dot.dot adress sugestion) what doing disonanse for me and don’t have trust. I’m new with this all workspace.
> 
> W dniu pi?tek, 15 listopada 2013 18:21:29 UTC+1 u?ytkownik Charles Skelton napisa?:
> 
> > the exception shown is reporting that the server does not have .u.sub defined.  
> > All the drivers (c#,java,..) are fairly simple [de]serializers, all following the same pattern.
> > 
> > You can serialize objects, send them to kdb+ for execution, and optionally receive a return value.
> > 
> > We’ll create some examples.
