Jira Integration in C# [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am very new to this.So pardon me if I make any mistakes.
I am trying to read the Jira database.I just need to read it.
No write operations will be involved.
I am using C#.From what little I know, I think a connection has to be established with the Jira database using
SqlConnection conn=new SqlConnection(connectionstring);
And then I can read data using SqlReader.I have tried searching through the database and found few links like http://www.codeproject.com/Tips/762516/Connecting-to-Jira-using-Csharp
But I am not being able to understand.Can anyone help me out or direct me to few resources.
In the links that I searched through there are terms like "Rest API" etc. Do I need to know them ?

If you have access to the database, and want to read data that way, that's entirely possible using standard .NET objects, but you'll probably need to be decent at SQL to get the data out that you want.
Here's how you can (try to) access the database:
SqlDataReader rdr = null;
SqlConnection conn = new SqlConnection("YOUR_CONNECTION_STRING_HERE");
SqlCommand cmd = new SqlCommand("select * from whatever_jira_table", conn);
rdr = cmd.ExecuteReader();
//look up how to read from a reader
conn.Close();
conn.Dispose();
Another option is to use a Jira API which it looks like you can get from NuGet through Visual Studio. If you go this route, you need access to the Jira REST API, and it will expose a more friendly (different?) way to access data.
Either way, just go into Visual Studio, make a console app, and start adding code and stepping through with the debugger until thing start making sense.

Related

Get data from remote sql server in a .NET web service [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have created a simple web service in visual studio 2015 with C#. I have set up an sql server database with a table and i want to simply return any value from that table.
By searching i haven't found a very explanatory tutorial.
Should i add a server connection in VS and then use linq or use SqlConnection?
I also included an ADO Entity data model in the project but i don't know how to use it in the webMethod.
Does any good tutorial exist about all options that i have to connect to the db and provide some examples, too?
Since it's a web application I suggest saving the connection string into web.config.
Example:
<connectionStrings>
<add name="ConnStringNameHere" connectionString="Data Source=IPadress;Initial Catalog=databaseName;Integrated Security=False;User ID=name;Password=pass" providerName="System.Data.SqlClient" />
</connectionStrings>
You just have to add the user in SQL Server with the appropriate permissions.
That way you can have a couple of connection strings, each for a user type with specific permissions (some can only read, some can write, etc.)
You make a connection to the database with this simple code:
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["connStringName"].ConnectionString))
using (SqlCommand cmd = new SqlCommand("SELECT * FROM user WHERE userName = username", connection))
{
connection.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
string id = (string)reader["Id"].ToString();
//work here
}
}
connection.Close();
}
And a useful link: http://www.codeproject.com/Articles/837599/Using-Csharp-to-connect-to-and-query-from-a-SQL-da

c# sql connection through internet [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I was wondering if can I connect to sql database from another computer without installing sql server (is this possible). I am creating a c# wpf program that would get and insert data in sql database that is placed in my PC, in all computers where this program is installed using internet. Should I use in connection string my internet IP, or what, because I’m confused?
My connection string
String connString = #"Network Library=dbmssocn;
Network Address=127.0.0.1,1433;
Integrated security=SSPI;
Initial Catalog=db";
Also i forgot to say that i'm new in programing area, and i want to connect to sql database through lan connection
Assuming that your remote database (on your other computer) accepts remote connections, you can accomplish this via a traditional ADO.NET connection or you could use an ORM like Entity Framework to handle the connection.
You can see an example below that takes advantage of the SqlConnection class which does exactly what it's name implies :
using(var sqlConnection = new SqlConnection("Your Connection String"))
{
var query = "Your Query";
using(var sqlCommand = new SqlCommand(query,sqlConnection))
{
sqlConnection.Open();
// Execute your query here using sqlCommand.ExecuteNonQuery()
// or some other execution method
}
}
You would just need to ensure that your actual connection string to target your remote database is correct.
Yes, it is possible. You could use ADO.NET or Entity Framework to accomplish this goal. However, I would recommend setting up a web api on the sever you have hosting the database, which you could call to get/post data. I personally wouldn't hard code any connection strings in the program you plan to deploy to end user workstations. Just call the web api and let your web api talk to the database.

Pulling from a database and displaying with c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm just starting out with server side code and Visual Studio with C#, but something I can't figure out with my googling is how do people use C# and Visual Studio to access a database and pull results and display them on the html documment?
I have an SQL Server 2012, I believe I know how to connect to the database itself, but unless I use classic ASP I don't understand how to pull it from the database and display it using C# and or ASP.NET.
I suggest you start out with Ado.Net. Once you have a good understanding of the principles, look into Entity Framework.
Robin Nadeau is right, what you'll probably want to start with is Ado.Net controls. In reference to your example, how I would go about it is using a DataGridView and binding it with a BindingSource + DataSet. When you drop a DataGridView on the form, it will give you a chance to run through a wizard to easily set up the BindingSource and Dataset.
To filter stuff from there, you'll need to hook up the buttons etc. with code such as this:
bindingSource1.Filter = string.Format("VideoTitle LIKE '{0}'", txtSearch.Text);
Hopefully that helps you get started.
If you are a beginner and don't have enough time to learn a complete framework. I would suggest to use the WebMatrix.Data Wrapper. Life's simple with it. 6 Commands is all you need to know to make 90% of the applications. Just install the Nuget Package and you're good to go.
Those 6 Commands are
1. Open & Close Connection
var db=Database.Open("name of connection string in web.config");
db.Close();
2. SELECT Query
foreach(var row in db.Query("SELECT * FROM tablename")
{
servervariable1=row.column1;
}
3. SELECT Single Row
var row=db.QuerySingle("SELECT * FROM tablename WHERE Key=#0",PassedVariable);
if(row!=null)
{
// do the operation
}
else
{
// handle code if the row is not found
}
4. SELECT Single Value
try{
datatype variable=db.QueryValue("SELECT columnname FROM tablename WHERE Key=#0",Key);
}
catch{
// handle code if row doesn't exists
}
5. INSERT Query
db.Execute("INSERT INTO tablename(column1,column2) Values(#0,#1)",inputvar1,inputvar2);
6. DELETE Query
db.Execute("DELETE * FROM tablename WHERE Key=#0",key);

How to call code from SQL in C# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have two classes in which the teachers have merged their final projects into one, one class is software engineering and another one is data bases. The thing is that for SE i have to develop a desktop/smartphone app and for DB i have to develop every DB related stuff for that app.
But i have to keep both things separated, i mean i have to keep C# code away from SQL code so i can't do queries or any stuff using selection strings and such, i just have to call stored procedures with said queries from code.
Any idea how could i do that? To summarize i just want to call any code or procedure that i write in sql and store it's values in a variable,object or array.
As i said i cannot use:
string selectstr = "SELECT * FROM students;"
and execute that query, i have to write that in sql and call it from C# and store the values returned.
Stored procedures are called like any other SQL command in C#:
using (SqlCommand cmd = new SqlCommand("MyStoredProcedure", connection))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("#myParameter1", value);
...
using (SqlDataReader reader = cmd.ExecuteReader())
{
...
}
}
The "magic" bit is to set the command type correctly ;-)

C# MySQL DataRow with multiple values [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Is there a way to do a c# datarow like the below code in a SELECT * query
//Have results like blow
string username = (string)row["username"];
I've tried but all I seem to see is reader or something, witch I know nothing about and don't understand. Can you lead me to some code that will help or give me a example?
DataReader is actually exactly what you need. The 'DataRow' class by itself won't help you; that gets used as part of a more complex solution, the 'DataSet' class (which uses 'DataTable' and that in turn uses 'DataColumn' and 'DataRow'). I don't see many people using 'DataSet'; if you want something complex with drag-and-drop design, you should look at using Entity Framework.
Here is a standard way to read values from SQL in .NET via DataReader (which, no matter what anyone says, is the fastest way to simply read data from a SQL database in .NET):
using (var connection = new SqlConnection("<Your connection string here>")
{
var command = new SqlCommand(
"SELECT username, email FROM users;",
connection);
connection.Open();
var reader = command.ExecuteReader(); // Using the DataReader (specifically, the SqlDataReader)
if (reader.HasRows)
{
while (reader.Read())
{
Console.WriteLine("User {0} has email {1}", reader["username"],
reader["email"]);
}
}
else
{
Console.WriteLine("No rows found.");
}
reader.Close();
}
MSDN documentation for DataReader

Categories