Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 17:43

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help with Read Array from SQL Server

Discussion on Help with Read Array from SQL Server within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
kotsh's Avatar
 
elite*gold: 0
Join Date: May 2007
Posts: 360
Received Thanks: 27
Help with Read Array from SQL Server

Hello im learning on Supermike Source ,
There is Function calling getSingleArray But i can see it only Return first row of data
i want read an normal Array in C# its really hard
i hope someone can help me
Here's my code but its dont return anything

Code:
var dt = sqlCon.GetDataTable($"SELECT id,Title FROM {FilterMain.SUP_DB}.dbo.Titles where CharName = '{Program.Plis(this.sql_charname)}'");
Code:
public static List<string> GetDataTable(string query)
        {
            if (sqlCon.con.State == ConnectionState.Open)
            {
                SqlDataAdapter SqlAD = new SqlDataAdapter();
                SqlAD.SelectCommand = new SqlCommand(query, con);
                DataSet ds = new DataSet();
                SqlAD.Fill(ds);

                DataTable dt = ds.Tables[0];
                if (dt.Rows.Count != 0)
                {
                    var list = new List<string>();
                    for (var i = 0 ; i < dt.Rows.Count;i++)
                    {
                        list.Add(dt.Rows[i].Field<string>(0));
                        Console.WriteLine(i);
                    }
                    return list;
                }


            }
            else
            {
                sqlCon.con.Open();
                sqlCon.GetDataTable(query);
            }
            return null;
        }
kotsh is offline  
Old 06/30/2020, 06:48   #2
 
nice7's Avatar
 
elite*gold: 0
Join Date: Feb 2009
Posts: 31
Received Thanks: 22
return null; = dont return anything

you need to return data you want
nice7 is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Help] 2018-08-02 01:55:47 err=-1, [Microsoft][ODBC SQL Server Driver][SQL Server]Log
08/02/2018 - Shaiya Private Server - 2 Replies
Hi all! i have this problem any idea ? 2018-08-02 01:55:47 err=-1, Login failed for user 'your-db-username'., SQL STATE: 28000, NATIVE ERROR: 18456 (0x4818) 2018-08-02 01:55:47 ::LoadBillingItem 2 qerr=-1, EXEC usp_Read_Char_Product_Item_E 2
Read Coordinates from Config into Array
06/08/2015 - AutoIt - 4 Replies
Hallo, ich hab ein kleines Programm geschrieben und versuche es gerade etwas Benutzerfreundlicher zu machen. Ich lese aus einer config.ini Koordinaten und speichere sie einzeln in Variablen. Das sieht so aus: In der config.ini TopX=100 TopY=115 Im Script Global $x1 = IniRead("config.ini", "Koordinaten", "TopX", "0") Global $x2 = IniRead("config.ini", "Koordinaten", "TopY", "0")
[SQL]Array Speichern
09/05/2012 - Web Development - 10 Replies
Hallo, Ich würde gerne ein Array aus Java(bestimmte Benutzernamen) in einer SQL-Datenbank ablegen... Leider habe ich keine Idee wie ich dies anstellen soll... zwar gibt es die Datentypen Set und enum aber die helfen mir auch nicht richtig weiter, da sie nur bestimmte Werte aus einer Whitelist annehmen... Wäre es möglich die Namen vielleicht in einem String abspeichern zu lassen und Java es Java dann wieder in eine Array umwandeln zu lassen oder hat jemand eine andere gute Idee?
Array & IniWrite/Read
11/13/2010 - AutoIt - 6 Replies
Hallo alle zusammen, ehm mein Problem ist ich will in einem Spiel die Abgelaufenen Koordinaten abspeichern. Also wenn ich laufe soll angefangen werden die x&y Koordinaten abspeichern und dann diese immer in eine IniDatei speichern... Wichtig ist auch noch das diese Ini Datei später ausgelesen wird und in Zwei ListViews gezeigt wird. Aber es soll kein mindest laufen sein oder ein höchst laufen.... Damit meine ich das es egal ist wie viel ich laufe... Danke...
[question] sql basis data array code XD
02/15/2010 - Dekaron Private Server - 2 Replies
what is sql basis data array code alteration method? not php character encoding problem if see screenshot but it seems to be problem of sql data array code XD Help me :( http://pcmaket.com/images/guild.gif



All times are GMT +1. The time now is 17:43.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.