|
|
|
I'm developing a WCF RESTful web service with C# and .NET Framework 4.0. There is also a SQL Server database and I'm using Entity Framework Code First to access it.
And i use Android for get, post, ... in my service by json.
I have these two tables on SQL Server:
A user table for my application's user.
User
{
userId,
name,
country
}
And another table to store their thoughts about something.
Thought
{
thoughtId,
userId,
descrip
date
}
Now, I want to show mething like this:
User.name
Thought.description
Thought.date
I follow http://forums.asp.net/t/1774830.aspx[^]
but i have a problem: the Json String is inValidate format and i Can't convert it in my android project.
How Can I return a JSON object this way?
Please help me.
|
|
|
|
|
mrhs wrote: How Can I return a JSON object this way?
You don't.
Your user is going to 'use' 'thoughts' (plural). So you create rest api methods that allow a user (singular) to manage one or more thoughts (plural). So for EXAMPLE (example only) you might have the following Rest methods.
- Get a thought (by id)
- Get all thoughts (a list) for a user.
- Create a thought
- Delete a thought.
If you want the user to manage themselves then you would provide similar methods to manage the user (but not the thoughts.)
|
|
|
|
|
It was a bad sound.
Please help me to create or give me a idea.
I'm newbie in Android and WCF Rest service.
Thanks alot.
|
|
|
|
|
What specific part of the break down that I gave you did you not understand?
|
|
|
|
|
If you as me.
Could you developing a WCF RESTful web service with C# like my idea???
If I don't, please give me a idea, which help me fix my problems.
Thanks
|
|
|
|
|
mrhs wrote: If you as me.
Could you developing a WCF RESTful web service with C# like my idea???
Could I do it? Yes.
mrhs wrote: please give me a idea, which help me fix my problems.
Which part of my previous response did you not understand?
|
|
|
|
|
Hello,
I have a database I would like to know how to locate the FILESTREAM data
For a row in a table I want the physical location:
D:\Test_FSss\e0b4921f-8cb2-49c1-b4e7-f01a7376cac1
I tried patshname function but it does not give me the desired result.
Thank you in advance.
|
|
|
|
|
This sort of information is internal to the database and will be dependent on the type of database system.
Veni, vidi, abiit domum
|
|
|
|
|
there is no one thing is very important for my project.
|
|
|
|
|
Even if this is very important for your project, the fact is, for all the major database vendors there is no API call that will give you this information.
|
|
|
|
|
|
There is no need for anyone to know this information. Perhaps your question is not clear, please explain what you are trying to achieve.
Veni, vidi, abiit domum
|
|
|
|
|
I have a Cust table that exceeds 10T partitioned over several Filegroup, Filestream and includes the information of customers, my boss asked me to locate him physical location to make archiving and backup by another application
I hope to be clear.
thank you.
|
|
|
|
|
This is a Database issue and nothing to do with .NET. You should be talking to your Database administrator, or the company that produces the database. Also, you should use the Database administration tools for backup.
Veni, vidi, abiit domum
|
|
|
|
|
|
Err no. That's nothing to do with the question that was asked.
|
|
|
|
|
Why? Because "ImageSaveInDataBase.zip" doesn't exist on the CodeProject server?
|
|
|
|
|
No, because saving and retrieving an image from a database has absolutely nothing to do with getting the names of database filestreams.
|
|
|
|
|
No. It's not the answer because the OP is asking how to open up database filestreams.
|
|
|
|
|
|
Hello. I need a hand in my code. i wrote the following code. and i am trying to work with sql.
what should i change?
I really need some help with this :/
Public Class BindingContext
Dim _cn As New OleDb.OleDbConnection
Dim _DataAdapter As New OleDb.OleDbDataAdapter()
Dim _CommandBuilder As OleDb.OleDbCommandBuilder
Dim _DataSet As New System.Data.DataSet()
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim _provider As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
Dim _fullPath As String = "C:\Working Storage\Developments\LAB\Database Connection\Database Connection\Database\"
Dim _dataSource As String = "Data Source=" & _fullPath & "ADOnet.MDB"
_cn = New OleDb.OleDbConnection(_provider & _dataSource)
_DataAdapter.SelectCommand = New OleDb.OleDbCommand("SELECT * FROM tblCustomer", _cn)
_DataSet = New DataSet()
Try
_DataAdapter.Fill(_DataSet)
Catch eror As Exception
MsgBox(eror.Message)
End Try
cbDept.DataSource = _DataSet.Tables(0)
cbDept.DisplayMember = "Name"
cbDept.ValueMember = "ID"
Me.txtName.Text = "Sjflkjasdlk=fj"
txtName.DataBindings.Add("text", _DataSet.Tables("tblCustomer"), "Name")
txtEmail.DataBindings.Add("text", _DataSet.Tables(0), "Email")
txtAddress.DataBindings.Add("text", _DataSet.Tables(0), "Address")
cbDept.DataBindings.Add("SelectedValue", _DataSet.Tables(0), "DeptID")
End Sub
Private Sub cmdRequery_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRequery.Click
DBRequery()
Me.BindingContext(_DataSet.Tables(0)).CancelCurrentEdit()
Me.BindingContext(_DataSet.Tables(0)).Position = 0
RefreshData(True)
End Sub
Private Sub DBRequery()
cmdSave.Enabled = False
_DataSet.Clear()
Try
_DataAdapter.Fill(_DataSet)
Catch Eror As Exception
cmdAdd.Enabled = False
cmdUpdate.Enabled = False
cmdDelete.Enabled = False
MsgBox(Eror.Message, MsgBoxStyle.Exclamation, "Error Opening Database")
Close()
Exit Sub
End Try
txtCount.Text = Format(_DataSet.Tables(0).Rows.Count, "#,##0")
If _DataSet.Tables(0).Rows.Count > 0 Then
txtCurrent.Text = "1"
EnableNavigation()
End If
cmdAdd.Enabled = True
End Sub
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
Try
_DataAdapter.Update(_DataSet)
Catch eror As Exception
MsgBox("This was an error updating database." & ControlChars.CrLf & _
eror.Message)
End Try
End Sub
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click
If IsNumeric(txtGoto.Text) Then
If CInt(txtGoto.Text) = CDec(txtGoto.Text) Then
If 1 <= CInt(txtGoto.Text) And CInt(txtGoto.Text) <= CInt(txtCount.Text) Then
BindingContext(_DataSet.Tables(0)).Position = CInt(txtGoto.Text) - 1
RefreshData(True)
Else
GotoError()
Exit Sub
End If
Else
GotoError()
Exit Sub
End If
Else
GotoError()
Exit Sub
End If
End Sub
Private Sub GotoError()
MsgBox("This must be an integer between 1 and " & txtCount.Text & " inclusive", MsgBoxStyle.Exclamation)
End Sub
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Dim pDataRow As DataRow
pDataRow = _DataSet.Tables(0).NewRow()
pDataRow!name = txtName.Text
pDataRow!email = txtEmail.Text
pDataRow!Address = txtAddress.Text
_DataSet.Tables(0).Rows.Add(pDataRow)
txtCount.Text = CStr(CInt(txtCount.Text) + 1)
cmdSave.Enabled = True
txtCurrent.Text = txtCount.Text
EnableNavigation()
End Sub
Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
Dim pDataRow As DataRow
pDataRow = _DataSet.Tables(0).Rows(CInt(txtCurrent.Text) - 1)
BindingContext(_DataSet.Tables(0)).EndCurrentEdit()
pDataRow!name = txtName.Text
pDataRow!email = txtEmail.Text
pDataRow!address = txtAddress.Text
cmdSave.Enabled = True
End Sub
Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click
BindingContext(_DataSet.Tables(0)).RemoveAt(BindingContext(_DataSet.Tables(0)).Position)
txtCount.Text = CStr(CInt(txtCount.Text) - 1)
RefreshData(True)
cmdSave.Enabled = True
End Sub
End Class
Thank you sooo much for your time
|
|
|
|
|
What is the problem?
Is something happening that shouldn't?
does it error? if so what is the error message?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
The code i posted works fine. But i need to use SQL instead of Access.
And i am not an expert in SQL.
So , if possible, can you tell me what to change and how in order to use SQL instead of Access?
|
|
|
|